use Net::POP3; # This debug flag will print debugging code to your browser, depending on its value # Set this to 1 to send debug code to your browser. Set it to 0 to turn it off. my $DEBUG = 1; if($DEBUG) { $| = 1; open(STDERR, ">&STDOUT"); } # Set this variable to your POP3 server name my $ServerName = "my.server.com"; # Create a new POP3 object my $pop3 = Net::POP3->new($ServerName, Debug => 0) or die "Couldn't log on to server"; # Initiate the mail transaction my $UserName = "username"; my $Password = "password"; my $Num_Messages = $pop3->login($UserName, $Password); # Get the list of messages my $Messages; my $msg_id; $Messages = $pop3->list(); # Parse each message header for "From" and "Subject" fields foreach $msg_id (keys(%$Messages)) { if ($msg_id <$end){ next; } my $MsgContent = $pop3->top($msg_id, 50); PrintList($msg_id,@$MsgContent); my $delete = $pop3->delete($msg_id);