Posts RSS Comments RSS Computer Network, System and Security stuff
This wordpress theme is downloaded from wordpress themes website.

How to strip the attachment from an IMAP mail

While trying hard long and long hours to write a perl script that can extract attachments from pieces of e-mail, I realized that there were no clear info on the web on how to do, and that if I successed, I would publish that script.

Finally I succeded. That is actually very easy and that is probably why nothing was ever published about it. But, when you are a beginner in Perl (I learned it in 1 week), you normally need a little bit more help. Also, I was not alone in that case and there were a numerous questions on various forum, but without satisfying answers.

As I said, my script is extrimely simple.

It is based on the Mail::IMAPTalk module to establish the IMAP connection and on the MIME::Parser module to parse the mail as a MIME object (given by the first module).

I know there is a dedicated CPAN module to strip attachment : Mail::Attachment::Stripper, but, I could never get it to work and the author did not answer to my e-mail.

You will find the script here with some comments that should explain well :

attachment-stripper.zip

Of course, that is just a quick and dirty base : it is up to you to improve / correct / extend it to fit your needs. If so, be nice to update me here. ;)

Related posts:

  1. Perl : how to monitor a service remotely using sockets

One Response to “How to strip the attachment from an IMAP mail”

  1. on 09 Apr 2008 at 12:17 pmPatrick

    Thank you for this!
    I am trying to accomplish this too and it is indeed hard to find anything to get you on the way ;)

Trackback this post | Feed on Comments to this post

Leave a Reply

Still buying movies offline?