#!/usr/bin/perl # pop3 ssl client use warnings; use strict; use Mail::POP3Client; use IO::Socket::SSL; my $socket = IO::Socket::SSL->new( PeerAddr => 'pop.some.net', PeerPort => 995, Proto => 'tcp') || die "No socket!"; my $pop = Mail::POP3Client->new(debug=>1); $pop->User('me@some.net'); $pop->Pass('somepass'); $pop->Socket($socket); $pop->Connect(); for(my $i = 1; $i <= $pop->Count(); $i++ ) { foreach( $pop->Head( $i ) ) { /^(From|Subject):\s+/i && print $_, "\n"; } } $pop->Close(); #or without IO::Socket::SSL (less port choices) # my $pop = new Mail::POP3Client( # #DEBUG => 1, # USER => 'me@some.net', # PASSWORD => 'somepass', # HOST => 'pop.some.net', # USESSL => 1, # defaults to port 995 # # ); __END__ ############################################# #!/usr/bin/perl # smtp-ssl with auth use warnings; use strict; use Net::SMTP::SSL; my $user = 'user@yaya.net'; my $pass = 'somepass'; $server = 'your-smtp-server'; my $to = 'friend@some.net'; my $from_name = 'me'; my $from_email = 'user@yaya.net'; my $subject = 'smtp-ssl-auth test'; my $smtps = Net::SMTP::SSL->new($server, Port => 465, DEBUG => 1, ) or warn "$!\n"; # I just lucked out and this worked for auth (yeah inheritance :-) ) defined ($smtps->auth($user, $pass)) or die "Can't authenticate: $!\n"; $smtps->mail($from_email); $smtps->to($to); $smtps->data(); $smtps->datasend("To: $to\n"); $smtps->datasend(qq^From: "$from_name" <$from_email>\n^); $smtps->datasend("Subject: $subject\n\n"); $smtps->datasend("This will be the body of the message.\n"); $smtps->datasend("\n--\nVery Official Looking .sig here\n"); $smtps->dataend(); $smtps->quit(); print "done\n"; #You can alternatively just put everything in the #argument to $smtps->data(), #and forget about datasend() and dataend(); __END__