我的网络服务器正在运行网络邮件客户端。我已将此网络邮件客户端配置为使用单独的独立邮件服务器发送电子邮件。我可以成功地从此网络邮件向 Gmail 发送电子邮件。
但是,在尝试将电子邮件发送到我自己的域上的地址时,我可以看到我连接到独立服务器来发送电子邮件,如日志所述:
Nov 12 12:47:46 mx dovecot: imap([email protected]): Disconnected: Logged out in=291 out=2751
Nov 12 12:48:46 mx dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=192.168.1.11, lip=192.168.1.12, mpid=19294, TLS, session=<6pT3wzxd4QrAqAoM>
Nov 12 12:48:46 mx dovecot: imap([email protected]): Disconnected: Logged out in=291 out=2751
但是,mx 服务器本身并没有接收电子邮件,就像它接收来自其他域(即 gmail 等)的传入电子邮件一样,电子邮件似乎是在 Web 服务器上接收的,邮件日志显示:
Nov 12 12:27:12 myservername postfix/pickup[29249]: 3210A1020814: uid=56 from=<[email protected]>
Nov 12 12:27:12 myservername postfix/cleanup[29254]: 3210A1020814: message-id=<[email protected]>
Nov 12 12:27:12 myservername postfix/qmgr[29250]: 3210A1020814: from=<[email protected]>, size=532, nrcpt=1 (queue active)
Nov 12 12:27:12 myservername postfix/local[29256]: 3210A1020814: to=<[email protected]>, relay=local, delay=0.09, delays=0.06/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "sender")
Nov 12 12:27:12 myservername postfix/cleanup[29254]: 3F1291020816: message-id=<[email protected]>
Nov 12 12:27:12 myservername postfix/bounce[29257]: 3210A1020814: sender non-delivery notification: 3F1291020816
Nov 12 12:27:12 myservername postfix/qmgr[29250]: 3F1291020816: from=<>, size=2288, nrcpt=1 (queue active)
Nov 12 12:27:12 myservername postfix/qmgr[29250]: 3210A1020814: removed
Nov 12 12:27:12 myservername postfix/local[29256]: 3F1291020816: to=<[email protected]>, relay=local, delay=0.05, delays=0.03/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "sender")
Nov 12 12:27:12 myservername postfix/qmgr[29250]: 3F1291020816: removed
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
# 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_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydomain.com, localhost.com, , 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 = all
smtp_tls_security_level = may
如何让配置了我的 mx 记录的独立邮件服务器将我的网络邮件服务器邮件客户端通过它发送的电子邮件发送给自身,而不是发送回网络服务器?
答案1
您已在 Web 服务器上通过设置配置了 Postfix,使其相信它可以处理您域的所有传入邮件myhostname = mydomain.com
。通过此设置,Postfix 将始终尝试在本地为指定域传递邮件。
这显然不是你想要的。
相反,您应该简单地删除此设置,这将导致 Postfix 使用系统主机名(不应设置为裸域名),从而根据其 MX 记录为该域传递邮件。