Found some code that strips out the attachments and writes them as files. I tried it on 2 test files, one with 3 parts, another with about 15 parts. In both cases the script wrote out the attachments correctly. Here is that code with a 'print' added ..
use Email::MIME; use Email::MIME::Attachment::Stripper; use File::Slurp qw(slurp write_file); my $infile = '/home/******/Mail/.family.directory/1280915907.6583.I9x +0z:2,S'; my $m = Email::MIME->new( scalar slurp $infile ); my $s = Email::MIME::Attachment::Stripper->new( $m, 'force_filename' = +> 1 ); print $s->message; #displays "Email::MIME=HASH(0xe0fca8)" foreach my $attachment ( $s->attachments ) { write_file( $attachment->{filename}, { buf_ref => \$attachment->{payload} } ) or die "Can't write $attachment->{filename}: $!\n"; }
It displays - Email::MIME=HASH(0xe0fca8) How do I get the contents of part one into a variable so that I can them extract the email addresses please ?
In reply to Re^6: extracting name & email address
by peterr
in thread extracting name & email address
by peterr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |