I must have read davorg's mind. To follow on from his suggestion you could try something like:
You might find this noisy if you have broken MIME messages in your mailbox (like I have in the collection of spam above). In real life you might want to be a bit more defensive as to how you use the filename from the message.use strict; use warnings; + use Email::MIME; use Email::Folder::Mbox; + my $box = Email::Folder::Mbox->new('/home/jonathan/mail/spam'); while ( my $mail = $box->next_message ) { my $mess = Email::MIME->new($mail); + foreach my $part ($mess->parts()) { if ($part->content_type() =~ /image/i ) { open OUT, ">", "tmp/" .$part->filename or next; print OUT $part->body(); close OUT; } } + }
/J\
In reply to Re: Extracting MIME Encoded pictures from email
by gellyfish
in thread Extracting MIME Encoded pictures from email
by jmaya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |