Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

K, I've blown a sizeable chunk of my day trying to figure out how to get the messages from Net::POP3 into an mbox. I figure I wanna use addMessage, or ... something. Please help me??

Replies are listed 'Best First'.
Re: Mail::Box-addMessage vs. Net::Pop3
by jettero (Monsignor) on Oct 13, 2001 at 00:18 UTC
    My bets are, you're just not forming the From line... No problem... this works great (with mutt anyway):
    #!/usr/bin/perl use strict; use POSIX; use Net::POP3; my $pop = new Net::POP3 "pop3.domain.dom"; my $num = $pop->login("jobe", "password"); if( $num ) { print "There were $num messages.\n"; open OUT, ">snagged.mail" or die "crap ($!)"; for my $i (1..$num) { print "getting message #$i\n"; my $msg = $pop->get($i); $msg->[0] =~ m/<(.+?)>/; print OUT &strftime("From $1 " . q(%a %b %d %H:%M:%S %Y), loca +ltime), "\n"; print OUT $_ for @$msg; print OUT "\n"; } close OUT; } else { print "bad login\n"; }