I’ve never run into that problem, but I usually redirect cron mail by setting a mail alias for the user running the job. That might be why.
I think cron’s MAILTO
setting is only meant for usernames. In Ubuntu 24.04 man 5 cron
says this:
If MAILTO is defined (and non-empty), mail is sent to the user so named.
The example there only sets it to a username, not a full email address.
None of that explains why it’s adding the username to the outgoing address though. It should be prepending it to whatever Postfix has myhostname
set to.
I did notice that it never really calls out the ability to send mail outside of the local spool, but mailto should work with a fully-qualified email address (and does on every other system I run and have run.)
I have to assume there's some sort of bug in this version of cron when combined with a postfix relay running on the same machine. For now, I just have mailto set to "", and all of the jobs redirected to a file on the network where I just need to remember to look at it once in a while.
I may just remove the mailto variable altogether and see if it dumps mail into the local user spool.
I may just remove the mailto variable altogether and see if it dumps mail into the local user spool.
That’s what I would try right away. If it makes it there try setting an alias for that user.
As long as I can get the information somehow, I should be good.
It has the added benefit of removing all the errors from the mail.log...
Will make some changes later and see what happens.