Of course, I am running into problems. I have tried Mail::Sender but it is just hanging. SES uses nonstandard port of 465 but I am able to define that. I am able to connect from the command line:
SES says it requires TLS with SMTP. Mail::Sender doesn't seem to have support for this built in. So, I tried Email::Send::SMTP::TLS, but I am getting similar problems.# telnet email-smtp.us-east-1.amazonaws.com 465 Trying 107.20.160.81... Connected to email-smtp.us-east-1.amazonaws.com. Escape character is '^]'. HELO adsf Connection closed by foreign host.
Both packages just hang when trying to connect to the remote server for a minute or two and then disconnect with "connection not established" (Mail::Sender) or "Could not connect to SMTP server" (Email::Send::SMTP::TLS).
Here is what I am doing with Mail::Sender (I tried all the auth methods it supports with no luck):
And Email::Send::SMTP::TLS:open my $DEBUG, ">>smtp_log" or print STDERR "Unable to open smtp_log" +; ## Send an email my $sender = new Mail::Sender { from => $from, smtp => $server, port => '465', auth => 'login', authid => $username, authpwd => $password, debug => $DEBUG, debug_level => 4, } or print STDERR "Can't create Mail::Sender object: $Mail::Sender::Er +ror\n"; $Mail::Sender::NO_X_MAILER = 1; $sender->Open({ to => $to, subject => "Test Email", ctype => 'text/plain', encoding => "quoted-printable", }) or print STDERR "Can't open the message: $sender->{'error_msg'}\n"; my $msg = "This is a test email with Mail::Sender\n\n"; $sender->SendEnc($msg); close $DEBUG;
Because they are both hanging it really makes me think it is a port issue. But the fact that I can connect from the command line and that both packages are hanging (even though I am specifying the port) really has me at a loss. I know this is not a lot to go on, but any ideas, insight or other packages I should try would be greatly appreciated!my $server = "email-smtp.us-east-1.amazonaws.com"; my $port = 465; my $mailer = Email::Send->new( { mailer => 'SMTP::TLS', mailer_args => [ Host => $server, Port => $port, User => $username, Password => $password, Hello => 'testdomain.com', ] } ); use Email::Simple::Creator; my $email = Email::Simple->create( header => [ From => $from, To => $to, Subject => 'Test Email', ], body => 'This is a test', ); eval { $mailer->send($email) }; die "Error sending email: $@" if $@;
Thanks!
In reply to SMTP and TLS by Rodster001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |