修复名称解析后未发送 sendmail 消息

修复名称解析后未发送 sendmail 消息

在我的服务器上,sendmail 需要 60 秒才能发送一条简单的消息。经过一番谷歌搜索后,我发现这是由于 DNS 问题造成的。我有这个日志:

9 月 13 日 08:00:01 myserver sm-msp-queue[1493]:我的不合格主机名 (myserver) 未知;睡眠重试
Sep 13 08:01:01 myserver sm-msp-queue[1493]:无法限定我自己的域名(myserver)——使用短名称

解决方案是编辑 /etc/hosts 并添加末尾带有点的名称

127.0.0.1 本地主机 本地主机。
127.0.0.1 我的服务器 我的服务器。

现在,sendmail 运行速度非常快,但邮件不再发送。我只是向我的 Gmail 帐户发送一个“你好”。

回声“你好”|发送邮件-v“[电子邮件受保护]

我看到有人说远程服务器可能会拒绝消息,但我不明白,因为它们是在更改主机文件之前传递的。我不想托管邮件服务器。我只需要给自己发送消息。这是上面命令行的输出:

220 myserver. ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1; Fri, 18 Sep 2015 13:50:45 -0300; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO myserver.
250-myserver. Hello localhost [127.0.0.1], pleased to meet you
...
250 2.0.0 Verbose mode
>>> MAIL From:<www-data@myserver> SIZE=3 AUTH=www-data@myserver
250 2.1.0 <www-data@myserver>... Sender ok
>>> RCPT To:<[email protected]>
>>> DATA
553 5.1.8 <[email protected]>... Domain of sender address www-data@myserver does not exist
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
www-data@myserver... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1027
250 2.1.0 <>... Sender ok
>>> RCPT To:<www-data@myserver>
>>> DATA
250 2.1.5 <www-data@myserver>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <www-data@myserver>... Connecting to local...
050 <www-data@myserver>... Sent
250 2.0.0 t8IGojKw022539 Message accepted for delivery
www-data@myserver... Sent (t8IGojKw022539 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 myserver. closing connection

当我指定真实的发件人地址时,消息就会被传送:

回声“你好”|发送邮件-vf“[电子邮件受保护]” “[电子邮件受保护]

但为什么在无法解析自己的名称时才传递消息,而不是现在呢?

答案1

好的。我讨厌它发生的时候。我发布后才找到解决方案。 @thrig是对的。它必须是完全限定名称。我已将“hosts”文件更改为:

127.0.0.1 本地主机 localhost.local
127.0.0.1 myserver myserver.local

现在效果很好。谢谢你们。

相关内容