广告

本站里的文章大部分经过自行整理与测试

2017年1月2日星期一

ubuntu - postfix - Host not found 解决方法

Jan  2 17:55:33 ubuntu1610 postfix/error[1525]: 
C5206120FB0: to=<user@gmail.com>, 
relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.4.3, 
status=deferred (delivery temporarily suspended: Host or domain name not found. Name service error for name=smtp.gmail.com type=A: Host not found, try again)

1. 关闭 dnsmasq 插件, 重启

$ su
$ gedit /etc/NetworkManager/NetworkManager.conf

#dns=dnsmasq

$ systemctl restart network-manager

2. 检查

# /etc/resolv.conf 是 symlink, 连接到 /run/resolvconf/resolv.conf
$ cat /etc/resolv.conf
$ cat /var/spool/postfix/etc/resolv.conf

3. 修改后, 重启

# 在 /run/resolvconf/resolv.conf 文件头上加上 nameserver
$ gedit /etc/resolvconf/resolv.conf.d/head

# 这是 router 的 IP
nameserver 192.168.0.1

$ systemctl restart postfix

4. 再检查 (以下2个文件应该同步了)

$ cat /etc/resolv.conf
$ cat /var/spool/postfix/etc/resolv.conf

5. 再 mail 看看, 然后检查 mail.log

$ echo "This is a test" | mail -s "Subject" recipient@yahoo.com
$ tail -f /var/log/mail.log

没有评论:

发表评论