我正在尝试使用 Postfix 发送邮件,但所有电子邮件均出现以下错误:
May 13 12:44:46 myhost postfix/qmgr[12169]: A6D9644526: from=<[email protected]>, size=317, nrcpt=1 (queue active)
May 13 12:44:46 myhost postfix/smtp[12178]: A6D9644526: to=<[email protected]>, relay=none, delay=0.03, delays=0.02/0/0/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)
阅读链接的问题,我已经检查过/etc/resolv.conf
,/var/spool/postfix/etc/resolv.conf
它们都是相同的。我的resolv.conf
样子:
nameserver 2001:4b98:dc0:49::225
nameserver 217.70.184.225
nameserver 217.70.184.226
options timeout:1 attempts:3 rotate
dig mx gmail.com
作品:
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> mx gmail.com ;; global
options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status:
NOERROR, id: 64383 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY:
4, ADDITIONAL: 15
以下是 的内容/etc/postfix/main.cf
:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = myhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
知道为什么找不到邮件主机吗?
答案1
看来错误是由于 /etc/resolv.conf 中的 ipv6 地址引起的。我删除了它,现在它可以工作了。