无法从 EC2 实例通过 SES 发送邮件

无法从 EC2 实例通过 SES 发送邮件

我有一个运行 Magento 的 EC2 实例。我正在尝试设置 AWS SES,以便我们可以向客户和内部员工发送交易电子邮件,但是,我不断收到超时错误。

域名已在 SES 中设置并验证,我已配置 SMTP 用户。服务器运行 Debian 10 并使用 Sendmail 作为其 MTA。Sendmail 配置为使用 SES 的 SMTP 用户凭据发送邮件。

尝试通过命令行发送测试电子邮件得到以下结果:

/usr/sbin/sendmail -vf [email protected] [email protected]

From: [email protected]
To: [email protected]
Subject: AWS SES test email

This is a test message sent from SES using Sendmail

结果:

[email protected]... 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:<[email protected]> SIZE=136 [email protected] 250 2.1.0 <[email protected]>...
Sender ok
RCPT To:<[email protected]>
DATA 250 2.1.5 <[email protected]>... Recipient ok 354 Enter mail, end with "." on a line by itself
. 
050 <[email protected]>... Connecting to aspmx.l.google.com. via esmtp... 050 <[email protected]>... Connecting to
alt1.aspmx.l.google.com. via esmtp... 050 <[email protected]>...
Connecting to alt2.aspmx.l.google.com. via esmtp... 050
<[email protected]>... Connecting to alt3.aspmx.l.google.com. via
esmtp... 050 <[email protected]>... Connecting to
alt4.aspmx.l.google.com. via esmtp... 050 <[email protected]>...
Deferred: Connection timed out with alt4.aspmx.l.google.com. 250 2.0.0
19J4N5Q0004977 Message accepted for delivery [email protected]...
Sent (19J4N5Q0004977 Message accepted for delivery) Closing connection
to [127.0.0.1]
QUIT 221 2.0.0 mta.example-domain.com closing connection

如果我尝试从服务器 telnet 到 SES 端点,我会得到以下信息:

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.

在我的 EC2 实例中,我目前已为入站和出站流量打开所有端口(我知道这不是理想的情况,但这只是暂时的,直到我能解决这个问题)。我完全不知道这里发生了什么。任何帮助都将不胜感激!

相关内容