Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem With MIME

Status
Not open for further replies.

spinalwiz

Programmer
Feb 25, 2003
32
IT
I'm trying to extract the plain text parts from multi-part email messages. I'm using Mail::Box and MIME::Entity and everything seems to work fine. Except I occasionally get an error message (see below).

It works with this MIME header:

This is a multi-part message in MIME format.
------=_NextPart_000_0724_01C1FA74.8E24C7D0
Content-Type: text/plain; charset="iso-8859-1"
Content-Length: 1434
Lines: 47


But not with this one:

--=_7825917C.DDBCFA0B
Content-Type: message/rfc822
Content-Length: 2464
Lines: 55


The basic code I am using is along the line of:

my $convert = Mail::Message::Convert::MimeEntity->new;
my MIME::Entity $entity = $convert->export($message);

if ($entity->is_multipart()) {
foreach my $part ( $entity->parts() ) {
if ($part->mime_type eq 'text/plain') {
print $part->print_body;
}
}
}


Any ideas?
Thanks

This is the error message I recieve:
----------------------------------------------------------

Method Mail::Reporter::preamble() is not defined for a .
Mail::Reporter::AUTOLOAD('Mail::Reporter') called at /usr/lib/perl5/site_perl/5.8.0/Mail/Message/Body.pm line 279
Mail::Message::Body::AUTOLOAD('Mail::Message::Bo...') called at /usr/lib/perl5/site_perl/5.8.0/Mail/Message/Convert/MimeEntity.pm line 26
Mail::Message::Convert::MimeEntity::export('Mail::Message::Co...','Mail::Message::pa...') called at /usr/lib/perl5/site_perl/5.8.0/Mail/Message/Convert/MimeEntity.pm line 30
Mail::Message::Convert::MimeEntity::export('Mail::Message::Co...','Mail::Box::Mbox::...') called at imail.pl line 349
main::bodyToFile('friends') called at imail.pl line 653
main::learn() called at imail.pl line 422
main::main() called at imail.pl line 79
 
I think it may be a problem when dealing with forwarded messages?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top