Postfix不发送邮件,抱怨“找不到主机或域名”

tsh*_*ang 11 debian postfix

我按照这些说明发送邮件,这是 Postfix 日志:

Sep 26 00:46:24 tshepang postfix/smtpd[5728]: 8EE2464931: client=localhost[127.0.0.1]
Sep 26 00:47:44 tshepang postfix/cleanup[5810]: 8EE2464931: message-id=<20110925224624.8EE2464931@tshepang>
Sep 26 00:47:44 tshepang postfix/qmgr[5772]: 8EE2464931: from=<tshepang@gmail.com>, size=350, nrcpt=1 (queue active)
Sep 26 00:48:04 tshepang postfix/smtp[5859]: 8EE2464931: to=<tshepang.test@gmail.com>, relay=none, delay=127, delays=107/0.01/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)
Sep 26 00:48:39 tshepang postfix/smtpd[5728]: disconnect from localhost[127.0.0.1]
Run Code Online (Sandbox Code Playgroud)

此外,这可能是相关的(来自“ /etc/postfix/main.cf ”):

myhostname = tshepang
mydestination = tshepang, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_interfaces = all
inet_protocols = all
Run Code Online (Sandbox Code Playgroud)

我在 Debian 6 上运行它。

小智 6

我曾经有同样的问题:

root@medusa:~# postqueue -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
079AC700080B      357 Wed Apr  3 13:47:47  root@medusa.yyyy.cz
(Host or domain name not found. Name service error for name=xxxx.cz type=MX: Host not found, try again)
                                         hmls@xxxx.cz
Run Code Online (Sandbox Code Playgroud)

..

root@medusa:~# host -t MX xxxx.cz
xxxx.cz mail is handled by 10 e2sgw01.xxxx.cz.
xxxx.cz mail is handled by 10 e2sgw02.xxxx.cz.
Run Code Online (Sandbox Code Playgroud)

..

root@medusa:~# telnet e2sgw01.xxxx.cz. 25
Trying 217.77.161.168...
Connected to e2sgw01.xxxx.cz.
Escape character is '^]'.
220 e2sgw01.xxxx.cz ESMTP Postfix
Run Code Online (Sandbox Code Playgroud)

问题出在 /var/spool/postfix/etc/resolv.conf 文件(chrooted 文件)中。看看它。


小智 1

您似乎位于代理后面:gmail.com 地址已解析,但 ping 命令未成功。您可以尝试直接连接 gmail 的 SMTP:

nc -w 1 gmail.com 25 ; echo $?
Run Code Online (Sandbox Code Playgroud)

如果它回显“1”,则无法连接,可能是安全过滤的原因。