Solved

Store (in mysql) & delete emails with attachments

Posted on 2004-10-27
157 Views
Last Modified: 2010-03-05
FYI, I'm a perl newbie...

Here is what I want accomplished...

1) Setup a list of bad attachment types
2) Store all emails with bad attachments in mysql (only info needed is from, to, subject, body, & attachment(s))
3) Delete emails with bad attachments

I've seen some websites discuss how to read emails & how to retrieve the file name of the attachment, but I'm not sure how to incorporate into one big perl...  any help is appreciated...
0
Question by:MitchellSTL
    12 Comments
     
    LVL 84

    Expert Comment

    by:ozo
    From where do you get the emails that you want to delete?
    0
     
    LVL 48

    Expert Comment

    by:Tintin
    What's your definition of a "bad attachment"?
    0
     

    Author Comment

    by:MitchellSTL
    ozo - I would get the email from a pop3 / imap email account.  The server has sendmail installed & it works.

    Tintin - I want to define bad attachments as having a certain filename extension...  i.e. *.bat, *.cmd, *.exe, *.scr, *.pif, *.exe, etc...  I would rather go by the filename's extension than the file's mime type...unless there is some huge advantage to do so.

    Does that answer the question(s)?
    0
     
    LVL 48

    Expert Comment

    by:Tintin
    More questions.

    So some mail is retrieved via POP3 and some via IMAP.  How do you know which is which?

    What are you actually trying to achieve?  If it is to stop potential email viruses/worms, then don't go by the filename extension, as almost all viruses use a false extension.
    0
     

    Author Comment

    by:MitchellSTL
    No it can be retrieved either way...  I have no preference on which protocol is used to read & purge messages.

    I'm just trying to delete an email if those attachments are present...more of a spam control in my case.  The only time that I receive spam is usually when it has a virus attachment...

    As for the filename extension, I don't care if it goes by filename or by mime type...

    If this is more complex than I thought, I can give 500 points for #1 & #2 and 500 points for #3...but all three have to be combined together as on script....does that make sense?  (well it did when I typed it)


    0
     
    LVL 48

    Expert Comment

    by:Tintin
    Why not implement a comprehensive spam solution?

    I can highly recommend SpamAssassin (http://www.spamassassin.org/).  I use it myself and it kills about 99% of spam.  It's written in Perl and also has an API if you want to write your own stuff.
    0
     

    Author Comment

    by:MitchellSTL
    I'll check it out...  be back shortly..
    0
     

    Author Comment

    by:MitchellSTL
    I've asked my service provider (because I think they are already using it) & they will not allow me to use or customize it for my mailboxes.  They recommended client side spam management programs.  They recommended two of them...  The first one has to use outlook and/or outlook express (too insecure for me & can't use at work).  The second was a bloomba.com's proxy product.  Their product does not work with browser based email clients AND Bloomba was purchased by Yahoo.com on 20-Oct-2004.  I'm pleading them to let me do something local, but I never know what I'll get from them....
    0
     
    LVL 48

    Expert Comment

    by:Tintin
    Do you have command line access on the mail server?
    0
     

    Author Comment

    by:MitchellSTL
    No I do not have command line access on the mail server...  My most recent email from them sounds as though they are sticking to their guns about me using client side spam tools...  So I think I'm back to my perl question/solution....

    0
     
    LVL 48

    Accepted Solution

    by:
    Well, you can still run spamassassin on your side.  All you need to do is retrieve the mail via Net::POP3 or Net::IMAP modules and pipe to spamassassin.
    0
     

    Author Comment

    by:MitchellSTL
    Okay... I'm willing to try, but I don't know how to go about it....  

    [I did say I was a newbie at perl, right?]
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now