#!/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__

In reply to SSL mail with auth by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.