0

I have an EC2 instance running Magento. I'm trying to get AWS SES set up so that we can send transactional emails to customers and to our staff internally, however, I keep getting timeout errors.

The domain is set up and verified in SES, I have an SMTP user configured. The server is running Debian 10 and Sendmail as its MTA. Sendmail is configured to use SES' SMTP user credentials for sending mail.

Trying to send a test email via command line gives this result:

/usr/sbin/sendmail -vf info@example-domain.com my@awesome-email.com

From: info@example-domain.com
To: my@awesome-email.com
Subject: AWS SES test email

This is a test message sent from SES using Sendmail

Results:

my@awesome-email.com... Connecting to [127.0.0.1] via relay... 220
mta.example-domain.com ESMTP Sendmail 8.15.2/8.15.2/Debian-14~deb10u1;
Tue, 19 Oct 2021 00:23:05 -0400; (No UCE/UBE) logging access from:
localhost(OK)-localhost [127.0.0.1]
EHLO mta.example-domain.com 250-mta.example-domain.com Hello localhost [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES
250-PIPELINING 250-EXPN 250-VERB 250-8BITMIME 250-SIZE 250-DSN
250-ETRN 250-AUTH DIGEST-MD5 CRAM-MD5 250-DELIVERBY 250 HELP
VERB 250 2.0.0 Verbose mode
MAIL From:<info@example-domain.com> SIZE=136 AUTH=info@example-domain.com 250 2.1.0 <info@example-domain.com>...
Sender ok
RCPT To:<my@awesome-email.com>
DATA 250 2.1.5 <my@awesome-email.com>... Recipient ok 354 Enter mail, end with "." on a line by itself
. 
050 <my@awesome-email.com>... Connecting to aspmx.l.google.com. via esmtp... 050 <my@awesome-email.com>... Connecting to
alt1.aspmx.l.google.com. via esmtp... 050 <my@awesome-email.com>...
Connecting to alt2.aspmx.l.google.com. via esmtp... 050
<my@awesome-email.com>... Connecting to alt3.aspmx.l.google.com. via
esmtp... 050 <my@awesome-email.com>... Connecting to
alt4.aspmx.l.google.com. via esmtp... 050 <my@awesome-email.com>...
Deferred: Connection timed out with alt4.aspmx.l.google.com. 250 2.0.0
19J4N5Q0004977 Message accepted for delivery my@awesome-email.com...
Sent (19J4N5Q0004977 Message accepted for delivery) Closing connection
to [127.0.0.1]
QUIT 221 2.0.0 mta.example-domain.com closing connection

If I try to telnet from the server to the SES endpoint, I get this:

telnet email-smtp.us-east-1.amazonaws.com 587

Trying 34.194.114.91...
Connected to email-smtp.us-east-1.amazonaws.com.
Escape character is '^]'.
220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-31RAO5EPD a2sb2LhwUqPVXiyXQJod
451 4.4.2 Timeout waiting for data from client.
Connection closed by foreign host.

In my EC2 instance currently, I have all ports open for inbound and outbound traffic (not ideal, I know, but this is temporary until I can figure this thing out). I'm completely at a loss for what's happening here. Any help is greatly appreciated!

  • Just to confirm, sendmail is passing email to SES to send out? In your "results" (not sure where that comes from) I would have thought we'd see SES headers. I'd be surprised if you can telnet to SMTP 587 as it's TLS. – Tim Oct 19 '21 at 05:57
  • Yes, sendmail is set up to connect to SES using SMTP credentials of the SMTP user I set up in SES. Trying to telnet to 465, 587, and 25 all give similar results: telnet email-smtp.us-east-1.amazonaws.com 587 (or 476, or 25) Trying 18.211.27.116... Connected to email-smtp.us-east-1.amazonaws.com. Escape character is '^]'. 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-3D12GBQSD c05pLyZapnEAuiPGvLo3 451 4.4.2 Timeout waiting for data from client. Connection closed by foreign host. – Chris Hood Oct 19 '21 at 15:18
  • @Tim if there's a better way to get the EC2 instance to send out emails using SES I'm open to it. I followed this guide trying to set it up: https://gist.github.com/amanjuman/1121efff59a69d6d3d76de2b35ba9afa – Chris Hood Oct 19 '21 at 15:43
  • That's one of the AWS services I haven't used. If you can clarify your question a bit that would be good. Where did "results" come from - are they mail headers? From the email sent by EC2 to SES? Or email headers for a reply? Does SES kept metrics or logs? Need a bit more info to help. – Tim Oct 19 '21 at 20:18

0 Answers0