Lists sender and subject on all mails in mailbox. MIME::WordDecoder is used to parse heads as most mails often has ISO-8859-1 encoded parts. It should be save to test it on any mailbox as it dosn’t change or remove anything from the mailbox.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/usr/local/bin/perl -w use strict; use Mail::POP3Client; use MIME::WordDecoder; my ($serv, $usr, $pwd) = (@ARGV); # server, username and password as comandline parameters... my $wd = default MIME::WordDecoder; my $pop = new Mail::POP3Client( USER => $usr, PASSWORD => $pwd, HOST => $serv ); print "Found " . $pop->Count() . " messages.n"; for (my $i = 1; $i <= $pop->Count(); $i++) { foreach ( $pop->Head( $i ) ) { if (/^(From|Subject):s+/i) { print $wd->decode($_); } } print "n"; } exit(); |