我从前任那里继承的 Apache 服务器不发送电子邮件。当服务器上托管的 Web 应用程序需要发送电子邮件时,它会在尝试发送电子邮件时阻止所有其他进程(让用户觉得它已冻结),直到失败。
我发出了以下命令(用有效的电子邮件地址替换 MY_EMAIL):
sendmail -vvv MY_EMAIL < email.txt
在 /var/spool/mail/root 中记录了以下内容
<MY_EMAIL>... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Tue, 23 Feb 2016 10:10:47 GMT
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From:<[email protected]> SIZE=53 [email protected]
250 2.1.0 <[email protected]>... Sender ok
>>> RCPT To:<MY_EMAIL>
>>> DATA
250 2.1.5 <MY_EMAIL>... Recipient ok (will queue)
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 u1NAAljf028766 Message accepted for delivery
<MY_EMAIL>... Sent (u1NAAljf028766 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 localhost.localdomain closing connection
我对此没有太多经验,这个日志文件有什么问题吗?
当我发出命令时:mailq
我刚刚尝试发送的电子邮件已添加到队列中:
/var/spool/mqueue (6 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
u1NA3bgF028698 32 Tue Feb 23 10:04 <[email protected]>
(host map: lookup (<DOMAIN>): deferred)
<MY_EMAIL>
u1NAAljf028766 32 Tue Feb 23 10:12 <[email protected]>
(host map: lookup (<DOMAIN>): deferred)
<MY_EMAIL>
u1N9O9Kx027456 2007 Tue Feb 23 09:25 <[email protected]>
(host map: lookup (<DOMAIN>): deferred)
<MY_EMAIL>
u1IEBMEa015156 1321 Thu Feb 18 14:12 <[email protected]>
(host map: lookup (<DOMAIN>): deferred)
<MY_EMAIL>
u1ID5lfY014306 1319 Thu Feb 18 13:07 <[email protected]>
(host map: lookup (<DOMAIN>): deferred)
<MY_EMAIL>
Total requests: 6
这是否(host map: lookup (<DOMAIN>): deferred)
意味着这是一个 DNS 问题?
答案1
这绝对看起来像是未配置的服务器。首先,localhost.localdomain
这是错误的。本地域部分必须明确定义为真实的东西。其次,sendmail 似乎localhost.localdomain
没有将此主机识别为本地可交付主机,可能是因为local-host-names
配置文件不包含它。您可以通过查看该文件并发出
sendmail -bv [email protected]
命令。日志中包含更多信息,请使用
grep u1NAAljf028766 /var/log/mailllog
。
无论如何,从配置 /etc/hosts 开始。