supercooled has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I frequently read PerlMonks (thanks for the great site) but this is my first post. I want to use Net::POP3 to connect to a pop mail server with SSL (Gmail). I can't find what to do anywhere in the documentation on the internet (maybe I am blind...). I tried 'USESSL => true' but that did not work. Can anyone help me out with this?

Replies are listed 'Best First'.
Re: Using Net::POP3 to connect with SSL
by zentara (Cardinal) on Sep 29, 2006 at 15:48 UTC
    Here are some Mail::POP3Client snippets I have, that may give you a starting point.
    #!/usr/bin/perl use Mail::POP3Client; $pop = new Mail::POP3Client( USER => "me", PASSWORD => "mypassword", HOST => "pop3.do.main" ); for( $i = 1; $i <= $pop->Count(); $i++ ) { foreach( $pop->Head( $i ) ) { /^(From|Subject):\s+/i && print $_, "\n"; } } $pop->Close(); # OR with SSL ##**<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $pop = new Mail::POP3Client( USER => "me", PASSWORD => "mypassword", HOST => "pop3.do.main", USESSL => true, ); # OR $pop2 = new Mail::POP3Client( HOST => "pop3.otherdo.main" ); $pop2->User( "somebody" ); $pop2->Pass( "doublesecret" ); $pop2->Connect() >= 0 || die $pop2->Message(); $pop2->Close(); # OR to use your own SSL socket... my $socket = IO::Socket::SSL->new( PeerAddr => 'pop.securedo.main', PeerPort => 993, Proto => 'tcp') || die "No sock +et!"; my $pop = Mail::POP3Client->new(); $pop->User('somebody'); $pop->Pass('doublesecret'); $pop->Socket($socket); $pop->Connect();

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Using Net::POP3 to connect with SSL
by Tanktalus (Canon) on Sep 29, 2006 at 15:41 UTC

    Well, looking at CPAN, I noticed GMail::Checker which may do what you want better. If not, you might look at its code as it claims to do POP3 over SSL.

    (On second thought, maybe don't read the code - they're doing the POP protocol directly rather than using Net::POP3... but it still may be a module you want to use, if not learn from.)

Re: Using Net::POP3 to connect with SSL
by jdtoronto (Prior) on Sep 29, 2006 at 15:43 UTC