Link to home
Start Free TrialLog in
Avatar of MitchellSTL
MitchellSTL

asked on

Store (in mysql) & delete emails with attachments

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...
Avatar of ozo
ozo
Flag of United States of America image

From where do you get the emails that you want to delete?
Avatar of Tintin
Tintin

What's your definition of a "bad attachment"?
Avatar of MitchellSTL

ASKER

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)?
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.
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)


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.
I'll check it out...  be back shortly..
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....
Do you have command line access on the mail server?
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....

ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?]