我的域名电子邮件由 gmail 托管,我已在域名托管商中将 mx 记录设置为 google 的。因此我的电子邮件运行正常。
但是,在我将域名(名称服务器)指向使用 Postfix 发送邮件的云服务器后,我的电子邮件停止工作 - 我无法接收。只能发送。这是我的 Postfix 配置:
// /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
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 2 on
# fresh installs.
compatibility_level = 2
# 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 = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = ipv4
但当我尝试向我的电子邮件帐户发送电子邮件时,例如[电子邮件保护]:
echo "This is a test email body." | mail -s "Subject" -a "From: [email protected]" [email protected]
我在日志中收到错误,例如:
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: warning: host something.com[xxx.xxx.xxx.xxx]:25 greeted me with my own hostname localhost
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: warning: host something.com[xxx.xxx.xxx.xxx]:25 replied to HELO/EHLO with my own hostname localhost
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: E8A82C1963: to=<[email protected]>, relay=something.com[xxx.xxx.xxx.xxx]:25, delay=0.07, delays=0.02/0.02/0.03/0, dsn=5.4.6, status=bounced (mail for something.com loops back to myself)
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtpd[62919]: disconnect from unknown[xxx.xxx.xxx.xxx] ehlo=1 quit=1 commands=2
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/cleanup[62933]: 03507C1964: message-id=<20201126112627.03507C1964@localhost>
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/bounce[62935]: E8A82C1963: sender non-delivery notification: 03507C1964
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/qmgr[62878]: 03507C1964: from=<>, size=2207, nrcpt=1 (queue active)
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/qmgr[62878]: E8A82C1963: removed
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/smtp[62934]: 03507C1964: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.206.26]:25, delay=0.82, delays=0/0/0.13/0.68, dsn=2.0.0, status=sent (250 2.0.0 OK 1606389987 a7si5380005wmf.125 - gsmtp)
Nov 26 12:26:27 ubuntu-4gb-fsn1-1 postfix/qmgr[62878]: 03507C1964: removed
我已经在域名主机上设置了 SPF 记录,例如:
v=spf1 ip4:xxx.xxx.xxx.xxx include:_spf.google.com ~all
在我的域名的名称服务器完全传播之前,这个功能是有效的。但现在它停止工作了。
我还错过了什么?