in reply to Attachment Extraction from Imap

Any chance anyone can fill in the missing chunk at the bottom where it says Attachment Parse Here?

You can, I'll show you how

Use Data::Dump::dd( $client->message_string($seqno ); to get sample data to get your parsing program ( How do I post a question effectively? ), no need to actually connect to your account multiple times until you figure this out :)

Then, since you've chosen MIME::Parser, you go to MIME::Parser, then up to http://search.cpan.org/~dskoll/MIME-tools-5.502/, then http://search.cpan.org/~dskoll/MIME-tools-5.502/MANIFEST and find mimeexplode

Then you use File::Temp to create a temporary working directory, or you specify one in ~home (File::HomeDir, File::UserConfig), and use IPC::Run3 to call and give mimeexplode your $email_string, and then use File::Find::Rule::Image or glob to query your working directory for new files, and maybe use mimetype (or File::Type ) to make sure you don't miss an unknown image

All the better distributions have samples ready for easy copy/paste, you can find others with site:perlmonks.org mimetype, site:perlmonks.org mimeexplode, site:perlmonks.org IPC::Run3

Does that help?

Replies are listed 'Best First'.
Re^2: Attachment Extraction from Imap
by Anonymous Monk on May 14, 2012 at 05:57 UTC