Sendmail 仅本地发送

Sendmail 仅本地发送

我编写了一个脚本,当现有进程不可用时向我发送电子邮件,因此我按照其他地方的建议安装了 sendmail。我知道为什么我会遇到这个问题,但要么我不知道如何解决它,要么我记错了。每当我运行:

root# sendmail [email protected]
test
.
root#

我只能在安装了 sendmail 的服务器上本地接收电子邮件,而不能[电子邮件保护]。日志通常显示 5-6 个条目,如下所示:

timestamp [email protected]... User unknown

timestamp sendmail[17220]: v2OIL5pc017220: [email protected], delay=00:00:00, mailer=local, pri=0, dsn=5.1.1, stat=User unknown

timestamp sendmail[17220]: v2OIL5pc017220: from=root, size=5, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost

timestamp sendmail[17220]: v2OIL5pc017220: v2OIL5pd017220: DSN: User unknown

timestamp sendmail[17220]: v2OIL5pd017220: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31029, dsn=2.0.0, stat=Sent

在我看来,问题在于 sendmail 开始正确发送电子邮件,但随后在本地发送电子邮件。它将中继设置为本地主机,然后将 to: 更改为 root,我不明白为什么。我在 hosts 文件中添加了一条记录,并在 sendmail.mc 文件中将 mail.mydomain.com 添加为 SMART_HOST。

为了测试目的,我在 iptables 中制定了接受所有策略。当我执行 tcpdump 时,我可以看到 DNS 请求到达我的 DNS 服务器,但我从未看到任何 SMTP 流量。Linux 非常棒,但有时也令人沮丧……

相关内容