Sendmail - 调试传出 SMTP 会话

Sendmail - 调试传出 SMTP 会话

我正在尝试使用 sendmail 发送电子邮件。我遵循了以下操作方法:http://linuxconfig.org/configuring-gmail-as-sendmail-email-relay

我尝试通过控制台发送电子邮件:

echo "Just testing my sendmail gmail relay" | mail -v -s "Sendmail gmail Relay - New Server" user@gmailcom

命令的输出是:

WARNING: local host name (server01) is not qualified; see cf/README: WHO AM I?
[email protected]... Connecting to [127.0.0.1] via relay...
220 server01 ESMTP Sendmail 8.14.4/8.14.4; Thu, 10 Dec 2015 18:05:36 -0200
>>> EHLO server01
250-server01 Hello server1 [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<root@server01> SIZE=279
250 2.1.0 <root@server01>... 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
>>> .
250 2.0.0 tBAK5aGc015664 Message accepted for delivery
[email protected]... Sent (tBAK5aGc015664 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT

221 2.0.0 server01 关闭连接但电子邮件始终未送达。你们能帮帮我吗?

日志:

Dec 10 19:03:31 server01 sendmail[16310]: tBAL3Uua016310: from=root, size=279, class=0, nrcpts=1, msgid=<201512102103.tBAL3Uua016310@server01>, relay=root@localhost
Dec 10 19:03:31 server01 sendmail[16311]: tBAL3VCu016311: from=<root@server01>, size=524, class=0, nrcpts=1, msgid=<201512102103.tBAL3Uua016310@server01>, proto=ESMTP, daemon=MTA, relay=corp-poa-pabx1 [127.0.0.1]
Dec 10 19:03:31 server01 sendmail[16310]: tBAL3Uua016310: [email protected], ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30279, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (tBAL3VCu016311 Message accepted for delivery)
Dec 10 19:03:32 server01 sendmail[16313]: STARTTLS=client, relay=gmail-smtp-msa.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Dec 10 19:03:33 server01 sendmail[16313]: tBAL3VCu016311: to=<[email protected]>, ctladdr=<root@server01> (0/0), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=120524, relay=gmail-smtp-msa.l.google.com. [64.233.190.108], dsn=5.0.0, stat=Service unavailable
Dec 10 19:03:33 server01 sendmail[16313]: tBAL3VCu016311: tBAL3XCu016313: DSN: Service unavailable
Dec 10 19:03:33 server01 sendmail[16313]: tBAL3XCu016313: to=<root@server01>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31757, dsn=2.0.0, stat=Sent

提前致谢..

答案1

Sendmail - 调试传出 SMTP 会话

Gmail 拒绝接受您的电子邮件。

12月10日 19:03:33 server01 sendmail[16313]: tBAL3VCu016311:[电子邮件保护],ctladdr=root@server01 (0/0),delay=00:00:02,xdelay=00:00:02,mailer=relay,pri=120524,relay=gmail-smtp-msa.l.google.com。[64.233.190.108],dsn=5.0.0,stat=服务不可用

以 root 身份执行以下命令以详细模式发送测试消息
(您将看到 SMTP 会话记录):

(echo Subject: test; echo; echo test)|/usr/sbin/sendmail -Am -i -v [email protected]

您可以-d60.5在 sendmail 命令行选项(收件人地址之前)中添加跟踪地图/数据库查找,包括authinfo查找(搜索 SMTP AUTH 的密码)。

答案2

向 gmail、yahoo、msn 等大型服务器发送电子邮件可能比较棘手,因为通过它们的反垃圾邮件保护需要所有配置都处于完美状态。

您需要检查以下内容:

  1. 使用解析到您 IP 的实际域名作为系统的主机名。因此,server01您应该使用your-company.com

  2. 确保您的 IP 已配置 PTR DNS 记录,以解析为您用于发送电子邮件的同一域(your-company.com

  3. 确保你得到已配置 SPF DNS 记录为了your-company.com

  4. 确保你使 DKIM 正常工作,对来自您服务器的每封电子邮件进行加密。

这些步骤足以让您的电子邮件真正到达 Gmail。

相关内容