Logwatch 电子邮件失败,显示“发件人域无效”

Logwatch 电子邮件失败,显示“发件人域无效”

我手动运行 logwatch(没有 cron 作业)。我使用 nullmailer 通过我的 ISP 的 SMTP 服务器从服务器发送电子邮件。我可以从命令行发送测试电子邮件,没有问题。但是 logwatch 使用的“发件人”地址不正确,导致我的 ISP 拒绝该电子邮件,而且我找不到要更改的设置。

在我的 logwatch 配置文件中,我有。logwatch 生成的电子邮件的前几行如下所示:MailFrom = [email protected]

[email protected]
[email protected]

Received: (nullmailer pid 5939 invoked by uid 0);
    Sun, 25 Sep 2016 15:25:02 -0000
To: [email protected]
From: [email protected]
Subject: Logwatch for myserverhostname (Linux)

请注意,文件第一行中的地址已myserverhostname插入其中。不幸的是,这似乎是真正使用的地址。From: 行上的域是正确的,并且可以工作,只是它将我的用户名更改为 root。To: 行和文件的第二行匹配。

注意:发件人:地址与 logwatch 配置文件中显示的地址不完全一致。我指定了,它在发件人中显示为。看来 logwatch 的配置文件设置在某处被覆盖了。MailFrom = [email protected][email protected]

我怎样才能阻止 logwatch 插入myserverhostname发件人地址并将我的名字更改为root

编辑:logwatch.conf 的相关部分

# Default person to mail reports to.  Can be a local account or a
# complete email address.  Variable Output should be set to mail, or
# --output mail should be passed on command line to enable mail feature.
MailTo = [email protected]
# WHen using option --multiemail, it is possible to specify a different
# email recipient per host processed.  For example, to send the report
# for hostname host1 to [email protected], use:
#Mailto_host1 = [email protected]
# Multiple recipients can be specified by separating them with a space.

# Default person to mail reports from.  Can be a local account or a
# complete email address.
MailFrom = [email protected]

mail.log 中的错误

Sep 25 11:15:52 myserverhostname nullmailer[10724]: smtp: Failed: 550 5.1.0 <[email protected]> sender rejected : invalid sender domain

结论 当 logwatch 生成电子邮件时,它不会使用我在配置文件的 MailFrom 行中提供的值。

在 MailFrom 上,我提供了它[email protected],但它用[email protected]在电子邮件的第一行和[email protected]电子邮件的 From: 行中。我需要它[email protected]至少在第一行中说明。如果我手动编辑电子邮件并替换该行,它就会发送成功。

答案1

非常感谢海因内玛感谢他的有益建议。他向我指出了第二个配置文件,可以修改该文件来修复该问题。

事实证明,这不是 logwatch 或 nullmailer 的问题,而是 sendmail 本身的问题。sendmail 忽略了 logwatch 配置文件中的输入,并插入了其自己的发件人地址值。

幸运的是,该/user/share/logwatch/dist.conf/logwatch.conf文件有一行

mailer = "/usr/sbin/sendmail -t"

我能够通过将其更改为以下方式强制使用正确的发件人地址:

mailer = "/usr/sbin/sendmail -t -f [email protected]"

相关内容