Here is some working code that uses Net::SMTP::SSL.

I would have had this this morning, but it took me a long time to figure out that the LocalPort parameter is necessary, or else IO::Socket::INET fails in _sock_info().

#!/usr/bin/perl -w use strict; use warnings; use Net::SMTP::SSL; my $smtp = Net::SMTP::SSL->new( 'smtp.att.yahoo.com', Hello => 'mymachine.org', Port => 465, LocalPort => 0, # Necessary Debug => 1); die("smtp undefined: $@") if !defined $smtp; my $acct_id = "your_full_userid_here"; # name@domain my $acct_pw = "your_password_here"; my $dest_addr = "destination_email_address"; # name@domain # Note two argument standard form. my $auth_return = $smtp->auth($acct_id, $acct_pw); # The mail() address must be your account's user id or else you'll get # the dreaded "553 From address not verified" error. # You cannot simply use $ENV{USER}. my $mail_return = $smtp->mail($acct_id); my $to_return = $smtp->to($dest_addr); $smtp->data(); $smtp->datasend("To: $dest_addr\n"); $smtp->datasend("From: $acct_id\n"); # Could be any address $smtp->datasend("Subject: Sending with Net::SMTP::SSL\n"); $smtp->datasend("\n"); # Between headers and body $smtp->datasend("This is the body, line1\n"); $smtp->datasend("This is the body, line2\n"); $smtp->dataend(); $smtp->quit; print "\nauth_return = $auth_return\n"; print "mail_return = $mail_return\n"; print "to_return = $to_return\n";

In reply to Re: SMTP authentication misery by gmargo
in thread SMTP authentication misery by cypress

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.