in reply to Parsing a multipart mail
I would suggest using Email::MIME - you can do something like:
use strict; use warnings; + use Email::MIME; use Email::Folder::Mbox; + my @received; my $box = Email::Folder::Mbox->new('/home/jonathan/mail/spam'); while ( my $mail = $box->next_message ) { my $main = Email::Simple->new($mail); + if ($main->header('Content-Type') and $main->header('Content-Type') + =~ /multipart/i ) { my $mess = Email::MIME->new($mail); + foreach my $part ($mess->parts()) { if ($part->content_type() =~ m%message/rfc822%i ) { print $part->as_string(); } } } + }
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing a multipart mail
by stingray (Initiate) on Mar 02, 2005 at 05:20 UTC |