不要发送本地邮件进行中继

不要发送本地邮件进行中继

我们在 Linux 服务器上向智能中继发送本地邮件时遇到问题。每次运行 cron 作业时,都会向 root 发送一封电子邮件。它被发送到中继,而不是在 /var/spool/mail/root 中本地传送。

这是发送给 root 的测试电子邮件的输出:

echo test | mailx -v root
root... Connecting to smtpp.example.com. via relay...
220 EXCHP12.example.com Microsoft ESMTP MAIL Service ready at Thu, 12 Oct 2023 15:50:51 +0200
>>> EHLO vm.example.com
250-EXCHP12.example.com Hello [x.x.x.x]
250-SIZE 37748736
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-BINARYMIME
250 CHUNKING
>>> MAIL From:<[email protected]> SIZE=185
250 2.1.0 Sender OK
>>> RCPT To:<[email protected]>
>>> DATA
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 2.6.0 <[email protected]> [InternalId=167383465460805, Hostname=EXCHP22.example.com] 1730 bytes in 0.134, 12.593 KB/sec Queued mail for delivery
root... Sent (<[email protected]> [InternalId=167383465460805, Hostname=EXCHP22.example.com] 1730 bytes in 0.134, 12.593 KB/sec Queued mail for delivery)
Closing connection to smtpp.example.com.
>>> QUIT
221 2.0.0 Service closing transmission channel

根据输出,服务器的默认 mta 是 sendmail.sendmail alternatives --list,但是服务器上没有运行 sendmail 服务。

当我使用 sendmail 测试电子邮件时。它被正确地放入 /var/spool/mail/root

echo 'test' | sendmail -Am -d60.5 -v root
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
root... Connecting to local...
root... Sent

为什么mailx 会发送根邮件来中继?

如何阻止根本地电子邮件被智能中继转发。

相关内容