#!/usr/bin/perl use Mail::MboxParser; my $mb = Mail::MboxParser->new('Mboxtest', decode => 'ALL'); # slurping for my $msg ($mb->get_messages) { print "###########################################################\n"; print $msg->header->{subject}, "\n"; print $msg->header->{from}, "\n"; print "###########################################################\n"; $msg->store_all_attachments('tmp'); my ($body) = $msg->body($msg->find_body,0); print ($body->as_string); print "###########################################################\n"; } print "############################################################\n"; print "############################################################\n"; print "############################################################\n"; # we forgot to do something with the messages $mb->rewind; while (my $msg = $mb->next_message) { # iterate again # ... } exit;