1

我正在尝试让守护程序从 Debian 10 服务器发送电子邮件。

我将 msmtp-mta 与 OVH SMTP 服务器一起使用。它已正确配置。

通过 mail 命令直接发送电子邮件时一切正常,如下所示:

echo "test" | mail -s "test" email@domain.com

但是,像 smartd 之类的一些守护进程会尝试向 root@localhost 发送电子邮件,但收件人地址格式不正确root,OVH SMTP 根本不喜欢:

send-mail: recipient address root not accepted by the server
send-mail: server message: 501 5.1.3 Invalid address
send-mail: could not send mail (account default from /etc/msmtprc)
Can't send mail: sendmail process failed with error code 65

并在 msmtp 日志中:

Apr 25 00:39:49 host=ssl0.ovh.net tls=on auth=on user=***REDACTED*** from=***REDACTED*** recipients=root smtpstatus=501 smtpmsg='501 5.1.3 Invalid address' errormsg='recipient address root not accepted by the server' exitcode=EX_DATAERR

我尝试添加root: email@domain.com到 /etc/aliases 和 relaoding with newaliases,甚至.forward在 root 的 homedir 中放一个。

有谁之前经历过这个吗 ?msmtp 不应该尊重 /etc/aliases 和/或 .forward 并替换 root 的电子邮件地址吗?

4

1 回答 1

1

请检查msmtp -v您是否有另一个别名可能会覆盖您设置的别名。您将能够使用该命令检查它是否正确注册了您的别名。

您可能还想添加aliases /etc/aliases到您的/etc/msmtprc文件中。

/etc/aliases如果您希望所有邮件都使用对应的 from 发送,您还可以添加默认别名:default: awesome.mail@example.tld

于 2020-04-27T19:57:56.853 回答