I just canīt find any module that filters email headers correctly. I am using Email::Filter now. Maybe Iīm doing something wrong, so here it is. Itīs a little dirty yet, so please donīt mind that:
use Net::POP3;
use Email::Filter;
my $pop = Net::POP3->new($host);
if ($pop->login($user, $pass) > 0) {
my $msgnums = $pop->list; # hashref of msgnum => size
foreach my $msgnum (keys %$msgnums) {
my $msg = $pop->getfh($msgnum);
my $message;
while (<$msg>) { $message .= $_; }
my $mail = Email::Filter->new(data => $message);
my $body = $mail->body;
print $body;
# $pop->delete($msgnum);
}
}
$pop->quit;
Email::Filter says this is the body:
This is a multi-part message in MIME format.------=_NextPart_000_0025_01C5BE3F.21ECA0A0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Hello
Just to test!
Bye!
Andr=E9
------=_NextPart_000_0025_01C5BE3F.21ECA0A0
Thanks
phoenix_fly