我正在运行一个 postfix 服务器 - 几个星期都没有问题,但现在邮件被退回。一天后,当我尝试向我的服务器发送邮件时,我收到了来自 gmail 的以下邮件:
[...]
Delivery to the following recipient has been delayed:
<the mailadress>@<myserver>
Message will be retried for 2 more day(s)
[...]
[mx.<myserver>. (0): Connection refused]
日志邮件日志,邮件错误和邮件警告除了一些奇怪的错误之外,都是空的:
postfix/trivial-rewrite[22141]: warning: regexp map /etc/postfix/virtual, line 12: ignoring unrecognized request
虚拟别名也是我上次唯一改变的东西(但之后它仍然有效)。
有什么提示可以告诉我如何解决此问题吗?
请注意,从本地用户向本地用户发送邮件是有效的。
尽管“127.0.0.2”对我来说看起来很奇怪,但还有一个开放的端口......
$ netstat -a|grep smtp
tcp 0 0 127.0.0.2:smtp *:* LISTEN
tcp 0 0 localhost.localdom:smtp *:* LISTEN
我的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.
myhostname = <my servername>
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#virtual_alias_maps = regexp:/etc/postfix/virtual
virtual_alias_maps = hash:/etc/postfix/virtual
myorigin = /etc/mailname
mydestination = <myserver>, localhost
relayhost = <my external smtp>
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
default_transport = smtp
relay_transport = smtp
inet_protocols = ipv4
答案1
你的inet_interfaces
范围设置为loopback-only
。这就是本地邮件传递正常运行的原因。
将其更改为all
,它将在所有接口上进行监听。
答案2
显然,您的电子邮件服务器只监听环回地址,如netstat
输出所示。您可以尝试在配置中注释掉以下行。
#inet_interfaces = loopback-only
不要忘记重新加载/重新启动您的 postfix 进程。最好使用 来确认此更改是否成功netstat
。