I ran your code in the debugger and did get a proper count, but first I got this:
main::(geemail.pl:15): my $port ='995';
DB<2>
main::(geemail.pl:17): my $pop = new Mail::POP3Client(
main::(geemail.pl:18): USER => $username,
main::(geemail.pl:19): PASSWORD => $password,
main::(geemail.pl:20): HOST => $mailhost,
main::(geemail.pl:21): PORT => $port,
main::(geemail.pl:22): USESSL => 'true',
main::(geemail.pl:23): DEBUG => 0,
main::(geemail.pl:24): );
DB<2>
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at C:/strawberry/perl/site/lib/Mail/POP3Client.pm line 376.
at C:/strawberry/perl/vendor/lib/IO/Socket/SSL.pm line 312.
IO::Socket::SSL::configure_SSL('IO::Socket::SSL=GLOB(0x3b909d0
+)', 'HASH(0x2adc148)') called at C:/strawberry/perl/vendor/lib/IO/Soc
+ket/SSL.pm line 264
IO::Socket::SSL::configure('IO::Socket::SSL=GLOB(0x3b909d0)',
+'HASH(0x2adc148)') called at C:/strawberry/perl/lib/IO/Socket.pm line
+ 49
IO::Socket::new('IO::Socket::SSL', 'Proto', 'tcp', 'PeerAddr',
+ 'pop.gmail.com', 'Type', 1, 'PeerPort', 995, ...) called at C:/straw
+berry/perl/vendor/lib
/IO/Socket/IP.pm line 331
IO::Socket::IP::new('IO::Socket::SSL', 'PeerAddr', 'pop.gmail.
+com', 'PeerPort', 995, 'Proto', 'tcp', 'Type', 1, ...) called at C:/s
+trawberry/perl/site/l
ib/Mail/POP3Client.pm line 376
Mail::POP3Client::Connect('Mail::POP3Client=HASH(0x3b8f088)')
+called at C:/strawberry/perl/site/lib/Mail/POP3Client.pm line 79
So, for me it worked at the next step
DB<2> l
26==> if (($pop->Count()) < 1)
27 {
28: print "I Can't get pop count";
29: exit;
30 }
31
DB<2> p $pop->Count()
320
DB<3>
but definitely hints at potential snags in the network/security configuration arena. |