I have been using Net::SMTP::TLS for my web application to send password reset emails using Google email for years.
my $smtp = Net::SMTP::TLS->new(email-smtp.us-east-1.amazonaws.com,
Hello => ,
Port => 587,
Timeout => 10,
Debug => 0,
User => [email protected],
Password => password123,
# NoTLS => !$gsmtpssl,
# Blocking => $blocking,
) or $c = 1;
print "TLS returned: $c,$smtp\n";
I have changed to Amazon's Simple Email Service. As documented in the AWS documentation, the email address that I'm using to send has been verified by Amazon SES. In the AWS console, I had to create SMTP credentials which were encrypted. Correct me if I am wrong, in order to send emails from a verified email address in AWS Simple Email Service, I need a SMTP username, SMTP password, SMTP server name and SMTP port. Which I was able to obtain.
smtpuser abc
smtppassword 123456
email-smtp.us-east-1.amazonaws.com
But I want to send emails using the [email protected]
and the smtp credentials provided to me by Amazon and it's not working.
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use Net::SMTP::TLS;
my $mailer = new Net::SMTP::TLS(
'email-smtp.us-east-1.amazonaws.com',
Hello => 'World',
Port => 587, #redundant
User => 'abc',
Password=> '123456');
print Dumper($mailer);
$mailer->mail('[email protected]');
$mailer->to('[email protected]');
$mailer->data;
$mailer->datasend("Sent thru TLS!");
$mailer->dataend;
$mailer->quit;
Perl Net::SMTP -
STARTTLS
andAUTH
via port 587 (msa)Use
Net::SMTP
. Its versions above 3.00 supportSTARTTLS
SMTP command.