#!/usr/bin/perl
use strict;
use Mail::MboxParser;
use Mail::MboxParser::Mail;
# name of mbox file
my $mymailbox="Inbox";
# no parser options
my $parseropts="";
open(FD,"$mymailbox");
# new mbox object
my $mb = Mail::MboxParser->new($mymailbox,decode=>'ALL',parseropts=> $parseropts);
print "Starting decoding of Messages\n";
my $message_counter = 0;
# msg loop
while (my $msg = $mb->next_message) {
$msg->store_all_attachments(path => "./attachments_Inbox/");
print "processed ".++$message_counter." messages\n";
}
print "DONE\n";
close (FD);
Modul Mail::MboxParser at cpan.org