为什么 postfix 没有在 /var/spool/mail 中接收邮件?

为什么 postfix 没有在 /var/spool/mail 中接收邮件?

我在 CentOS/EL7 AWS Lightsail 主机上尝试配置 postfix 以将传入邮件发送到用户帐户。但是,我还没有看到邮件到达 /var/spool/mail/*。

端口 25 上的 tcpdump 显示邮件到达我要发送邮件的服务器 (Gmail)。此外,我确信 postfix 正在运行,并且它是监听端口 25 的活动 MTA。

通过从 Gmail 发送邮件进行测试,我收到了以下退回邮件:

 The recipient server did not accept our requests to connect. Learn more at https://support.google.com/mail/answer/7720 [[domain omitted] [ip omitted]: generic::failed_precondition: connect error (111): Connection refused]

/var/log/maillog 中没有看到有关此流量的任何信息。

那么,也许邮件流量正在到达主机(由 tcpdump 证明)但被 postfix 的配置拒绝了?

答案1

通过在 AWS 主机上安装 iptables 并添加一条规则以允许从端口 25 到私有 AWS IP 地址的流量来解决此问题。

公共 IP 地址可以看到邮件进来(因此 tcpdump 输出很少)但无法将其交给私有网络接口(ifconfig 中显示的唯一接口)。

当我们启动 iptables 服务并在其配置中添加这条规则时,邮件就会流过。

相关内容