![Postfix 中继到本地而不是中继主机](https://linux22.com/image/637446/Postfix%20%E4%B8%AD%E7%BB%A7%E5%88%B0%E6%9C%AC%E5%9C%B0%E8%80%8C%E4%B8%8D%E6%98%AF%E4%B8%AD%E7%BB%A7%E4%B8%BB%E6%9C%BA.png)
我正在尝试通过 SMTP 服务器进行简单的 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
# 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.
#transport_maps = hash:/etc/postfix/transport
myhostname=testingserver.com
alias_maps=hash:/etc/aliases
alias_database=hash:/etc/aliases
myorigin=/etc/mailname
mydestination=testingserver.com, testingserver.intranet.com, localhost.testingserver.com, localhost.testingserver.intranet.com, localhost
mynetworks=127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
#mailbox_command = procmail -a "$EXTENSION"
#mailbox_size_limit = 0
#recipient_delimiter=+
inet_interfaces=all
relayhost = smtp.intranet.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
发送电子邮件时的 mail.log 如下,
testingserver.com postfix/pickup[27297]: 63A3720CAA: uid=1000 from=<ubuntu>
testingserver.com postfix/cleanup[27316]: 63A3720CAA: message-id=<[email protected]>
testingserver.com postfix/qmgr[27298]: 63A3720CAA: from=<[email protected]>, size=768, nrcpt=1 (queue active)
testingserver.com postfix/local[27319]: 63A3720CAA: to=<[email protected], orig_to=<ubuntu>, relay=local, delay=0.1, delays=0.07/0/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox)
testingserver.com postfix/qmgr[27298]: 63A3720CAA: removed
不确定如何调试这个,任何指针都很有用。
答案1
relayhost
仅当您发送路由到“远程”主机的电子邮件时使用。
由于您已将 testingserver.com 安装为 postfix myhostname
,并且您尝试将测试电子邮件发送到 @testingserver.com 电子邮件,因此 postfix 会将此电子邮件判定为本地电子邮件并将其传递给本地用户。
您的配置应该可以工作,只需使用“远程”地址进行测试即可。例如,尝试发送到 Gmail 帐户。