sodbrenner has asked for the wisdom of the Perl Monks concerning the following question:
1) Get a message
2) Do stuff to the body
3) Print the mail back, preserving attachments
#!/usr/bin/perl use Mail::Mbox::MessageParser; use Email::MIME; use Encode; my $infile = shift @ARGV; Mail::Mbox::MessageParser::SETUP_CACHE( { 'file_name' => 'mbox.cache' }); my $folder_reader = new Mail::Mbox::MessageParser({ 'file_name' => $infile, 'enable_grep' => 1, }); die $folder_reader unless ref $folder_reader; # This is the main loop. It's executed once for each email while(!$folder_reader->end_of_file()){ my $rawemail = $folder_reader->read_next_email(); my $email = Email::MIME->new($rawemail); $email->body_set("New Body Text"); print $email->as_string
but it seems to ignore the new body..
If I include EMail::MIME:Modifier, the text "New Body Text" is printed, but no attachments....How do I do this?
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Email::Mime Confusion
by saberworks (Curate) on Oct 06, 2009 at 15:40 UTC |