我的新云服务器仅在 ipv6 上运行。我已设置 AAAA mx 记录。Postfix 安装时使用以下配置:
$ sudo nano /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on
# fresh installs.
compatibility_level = 3.6
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ubuntu-4gb-fsn1-1
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost
relayhost =
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 = ipv6
myorigin = /etc/mailname
virtual_alias_domains = hash:/etc/postfix/virtual_domains
virtual_alias_maps = hash:/etc/postfix/virtual_forwards
我还设置将所有收到的电子邮件转发到我的 googlemail 帐户:
$ sudo nano /etc/postfix/virtual_forwards
[email protected] [email protected]
我对其进行了测试,并将电子邮件发送到其他 gmail 地址,一切顺利,例如:
$ echo "test email" | sendmail -F "L XXX" -f "[email protected]" [email protected]
$ sudo tail /var/log/mail.log
Jul 18 15:48:22 ubuntu-4gb-fsn1-1 postfix/pickup[46761]: 6766367234: uid=0 from=<[email protected]>
Jul 18 15:48:22 ubuntu-4gb-fsn1-1 postfix/cleanup[48067]: 6766367234: message-id=<20230718154822.6766367234@ubuntu-4gb-fsn1-1>
Jul 18 15:48:22 ubuntu-4gb-fsn1-1 postfix/qmgr[46403]: 6766367234: from=<[email protected]>, size=271, nrcpt=1 (queue active)
Jul 18 15:48:23 ubuntu-4gb-fsn1-1 postfix/smtp[48069]: 6766367234: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c08::1a]:25, delay=0.8, delays=0.02/0.02/0.12/0.65, dsn=2.0.0, status=sent (250 2.0.0 OK 1689695303 a5-20020adfeec5000000b003143d46910bsi1155011wrp.645 - gsmtp)
Jul 18 15:48:23 ubuntu-4gb-fsn1-1 postfix/qmgr[46403]: 6766367234: removed
但是当我尝试向雅虎地址发送电子邮件时出现以下错误,例如:
$ echo "test email" | sendmail -F "L XXX" -f "[email protected]" [email protected]
$ sudo tail /var/log/mail.log
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/cleanup[48086]: 7FC9567234: message-id=<20230718155217.7FC9567234@ubuntu-4gb-fsn1-1>
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/qmgr[46403]: 7FC9567234: from=<[email protected]>, size=271, nrcpt=1 (queue active)
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/smtp[48088]: warning: no MX host for yahoo.co.uk has a valid address record
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/smtp[48088]: 7FC9567234: to=<[email protected]>, relay=none, delay=0.04, delays=0.02/0.02/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=mx-eu.mail.am0.yahoodns.net type=AAAA: Host found but no data record of requested type)
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/cleanup[48086]: 8D9F567235: message-id=<20230718155217.8D9F567235@ubuntu-4gb-fsn1-1>
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/bounce[48089]: 7FC9567234: sender non-delivery notification: 8D9F567235
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/qmgr[46403]: 8D9F567235: from=<>, size=2440, nrcpt=1 (queue active)
Jul 18 15:52:17 ubuntu-4gb-fsn1-1 postfix/qmgr[46403]: 7FC9567234: removed
为什么?有什么办法可以解决这个问题吗?
当我的旧服务器使用 ipv4 时,雅虎地址没有问题。但雅虎似乎对 ipv6 有一些问题?
答案1
首先让我们查找 MX 记录
$ dig mx yahoo.co.uk
...
;; ANSWER SECTION:
yahoo.co.uk. 1717 IN MX 10 mx-eu.mail.am0.yahoodns.net.
...
现在让我们看看该主机名解析为哪些 IPv4 地址:
$ dig a mx-eu.mail.am0.yahoodns.net
...
;; ANSWER SECTION:
mx-eu.mail.am0.yahoodns.net. 60 IN A 188.125.72.73
mx-eu.mail.am0.yahoodns.net. 60 IN A 188.125.72.74
...
所有 2 个有效的 IPv4 地址,现在让我们检查 IPv6
$ dig aaaa mx-eu.mail.am0.yahoodns.net
; <<>> DiG 9.18.16 <<>> aaaa mx-eu.mail.am0.yahoodns.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58383
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
...
重点是,ANSWERS: 0
表示yahoo.co.uk
没有具有 IPv6 地址的邮件服务器。这意味着您的 IPv6 主机无法联系负责处理邮件的邮件服务器[email protected]
除非您的托管服务提供商支持某种形式的 NAT64,或者您使用同时支持 IPv4 和 IPv6 的邮件中继,或者 Yahoo 加入 20 世纪,否则您将会很倒霉。