Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2021-07-26 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?