use Net::POP3; my $pop = Net::POP3->new("webmail2.sonicwall.com"); my $numInboxMsgs = $pop->login('sdevassy', 'xxxxxx'); unless ($numInboxMsgs) { print "Could not login to pop3 mailbox."; exit 1; } if ($numInboxMsgs eq '0E0') { $numInboxMsgs = 0; } print "Found $numInboxMsgs messages in the Inbox."; #### #!/usr/local/bin/perl use Net::IMAP::Client; my $imap = Net::IMAP::Client->new( server => 'webmail2.sonicwall.com', user => 'sdevassy', pass => 'xxxxxx', ssl => 1, # (use SSL? default no) port => 993 # (but defaults are sane) ) or die "Could not connect to IMAP server"; # everything's useless if you can't login $imap->login or die( $imap->last_error);