I run logwatch manually (no cron job). I use nullmailer to send emails from the server using my ISP's SMTP server. I can send test emails from command line no problem. But logwatch is using a bad "From" address that causes my ISP to reject the email, and I can't find the setting to change.
In my logwatch config file I have
MailFrom = email@example.com. The first lines of the email generated by logwatch look like this:
firstname.lastname@example.org email@example.com Received: (nullmailer pid 5939 invoked by uid 0); Sun, 25 Sep 2016 15:25:02 -0000 To: firstname.lastname@example.org From: email@example.com Subject: Logwatch for myserverhostname (Linux)
Notice that the address in first line of the file has
myserverhostname inserted into it. Unfortunately, this seems to be the address that is really used. The domain on the From: line is correct, and would work, except that it changed my username to root. The To: line and the 2nd line of the file match.
Note: the From: address is not exactly what is shown in the logwatch config file. I specified
MailFrom = firstname.lastname@example.org and it shows up in the From as
email@example.com. It appears that the config file settings for logwatch are being overridden somewhere.
How can I stop logwatch from inserting
myserverhostname into the From address and changing my name to
Edit: relevant portion of 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 = firstname.lastname@example.org # 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@example.com, use: #Mailto_host1 = firstname.lastname@example.org # 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@example.com
The error from mail.log
Sep 25 11:15:52 myserverhostname nullmailer: smtp: Failed: 550 5.1.0 <firstname.lastname@example.org> sender rejected : invalid sender domain
Bottom line When logwatch generates the email, it is not using the value I supplied in the MailFrom line of the config file.
On MailFrom, I supplied
email@example.com but it used
firstname.lastname@example.org in the first line of the email, and
email@example.com in the From: line of the email. I need it to say
firstname.lastname@example.org in the first line at least. If I manually edit the email and replace that line, it sends just fine.