For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > August 2005 > Net::POP3 with SSL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Net::POP3 with SSL
Avi Kak

2005-08-30, 3:56 am



Hello:

Is there a version of the Net::POP3 module that works with SSL but
has essentially the same interface?

Any help would be much appreciated. Thanks.

Avi Kak (kak@purdue.edu)
Michael Kebe

2005-08-30, 7:56 am

Avi Kak schrieb:
> Is there a version of the Net::POP3 module that works with SSL but
> has essentially the same interface?


I found a Mail::POP3Client at search.cpan.org. Looks like it supports SSL.

Michael
zentara

2005-08-30, 6:58 pm

On Tue, 30 Aug 2005 06:27:50 GMT, Avi Kak <kak@purdue.edu> wrote:


>Is there a version of the Net::POP3 module that works with SSL but
>has essentially the same interface?
>
>Any help would be much appreciated. Thanks.


Hi, here is an untested script from origins unknown.

#!/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
socket!";
my $pop = Mail::POP3Client->new();
$pop->User('somebody');
$pop->Pass('doublesecret');
$pop->Socket($socket);
$pop->Connect();

__END__


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com