Una manera funcional de obtener el body de un mensaje de correo que quizá quiera ser analizado para otras tareas es la siguiente manera. Cabe aclarar que es una solución que generé por necesidad, claro esta, puede ser mejorado inclusive con mucho menos código... aunque, por el momento es útil para adaptarlo a nuestras aplicaciones.
use strict;
use Mail::Message;
use HTML::Entities;
my $rfc2822 = "";
{local $/; $rfc2822 = <STDIN>;}
sub getBody
{
my $data = shift;
my $ret = '';
my $type = 'plain';
my $obj = Mail::Message->read($data->{mail});
my $body = $obj->body;
if ($body->isMultipart) {
$type = 'html';
my @matches = $body->decoded->string =~ m/charset=\"PERL\"\n{2}(.*?)--(?:[0-9a-zA-Z]+)/gsc;
$ret = encode_entities($matches[1]);
$ret =~ s/^\s//;
$ret =~ s/\s$//;
$ret =~ s/^\n//;
$ret =~ s/\n$//;
$ret =~ s/\n\s*\n/<wbr \/>/g;
$ret =~ s/\n/ /g;
$ret =~ s/<wbr \/>/\n/g;
} else {
$ret = encode_entities($body->decoded->string);
}
$ret =~ s/& lt;/</g;
$ret =~ s/& gt;/>/g;
$ret =~ s/& quot;/"/g;
$ret =~ s/& amp;quot;/& quot;/g;
$ret =~ s/& amp;nbsp;/& nbsp;/g;
my $result = {body => $ret, type => $type};
return $result;
}
print getBody({mail => $rfc2822});
Simple y funcional, si tienes una idea mejor por favor compartela

Happy hacking!
#1 Re:Mail body decoded
great info,its function can using to wordpress
http://www.id3.info
http://www.arfree.com