At our installation, mail with a from address that claims to be from our domain is dropped if the user is not known. Local service accounts (which don't count as real users in this context) run cron jobs, with their mails being dropped because of this policy. We would like to be able to tell cron to use a different from address in the envelope in much the same way that you can tell it to use a different recipient using the MAILTO variable. I propose using a MAILFROM variable for this. I think this feature would be useful for others as well as for our situation. I can write the patch, I just wanted to check to see if you would consider including and distributing it before I went through the trouble. Reproducible: Always Steps to Reproduce:
Just to clarify, the current command cron uses to send mail is: /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t The proposed enhancement would allow specifying the envelope from address (not the header from address, which is already root), and basically result in cron running: /usr/sbin/sendmail -FCronDaemon -odi -oem -oi -t -f$MAILFROM It's pretty trivial, but we don't want to maintain a custom cron ebuild so if you're not interesting in adding it in portage we'll probably use a postfix rewriting map instead. This seems cleaner though. Another possibility would be to just hardcode -froot, considering that the header From is already root anyway, then they would just match. Currently the envelope from is the user whose job is running.
IMHO opinion this is good feature to have. feel free to attach a patch. whether we can include it largely depends on the patch - so no promises yet...
Created attachment 167640 [details, diff] Patch to implement MAILFROM feature
Any news on whether this patch will be included?
cronie - a fork of vixie-cron - has this change in its vcs. http://git.fedoraproject.org/git/?p=cronie.git;a=commit;h=48f16e2f14e3f22e5036c99c306e1262430f8bb6
https://github.com/cronie-crond/cronie/issues/17 also added MAILFROM support for anacron in cronie-1.5.2, so I'd just recommend migrating.
Package removed.