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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |