use Net::POP3; # Constructors #$pop = Net::POP3->new('pop.gmail.com'); $pop = Net::POP3->new('pop.gmail.com', ResvPort => 995, Timeout => 30, Debug => 1) or die("ERROR: Unable to connect.\n"); $username="sssssss"; $password="sssssss"; print $pop; if ($pop->login($username, $password) > 0) { my $msgnums = $pop->list; # hashref of msgnum => size foreach my $msgnum (keys %$msgnums) { my $msg = $pop->get($msgnum); print @$msg; } } $pop->quit;