[CentOS] Cron sending to root after changing MAILTO

Thu Jul 20 13:54:29 UTC 2017
Richard <lists-centos at listmail.innovate.net>

> Date: Thursday, July 20, 2017 02:25:52 +0000
> From: Richard <lists-centos at listmail.innovate.net>
> 
>> Date: Wednesday, July 19, 2017 23:31:10 +0000
>> From: Chad Cordero <ccordero at csusb.edu>
>> 
>> It’s being rejected before it even reaches the mailbox, so
>> forwarding won’t work.  Crond should really be using the MAILTO
>> variable and it’s not.
>> 
> 
> In my testing, this worked as advertised. Changing the "MAILTO=" in
> /etc/crontab from the default "root" to either a local username or a
> remote address resulted in the crontab messages being delivered to
> the desired mailboxes. I think I'd put a test command into the
> crontab and watch the logs to see what might be going on --
> including making certain that the crontab is reloading correctly
> after changing the "mailto" value.
> 
> Separately, but related, did you run newaliases or postalias after
> you added the entry to "root:" in /etc/aliases?
> 

Re-reading earlier messages, are the commands in question being
invoked out of /etc/crontab, /etc/cron.daily, etc. or  user-level
crontabs?

The "mailto" value is crontab file specific, so setting it in
/etc/crontab would only effect commands run from there (a file that
isn't used much any longer). As the /etc/cron.daily, etc. jobs are
now run from /etc/anacrontab you'd need to adjust the "mailto" in
that file for things run that way. If run from a user-level crontab
the "mailto" needs to be in that user's crontab file. [cron.hourly is
run out of /etc/cron.d/0hourly, not anacrontab, and has its own
"mailto".]