cron
cron copied to clipboard
Add MAILFROM parameter
Could you add the MAILFROM parameter to be used in addition to the MAILTO? Certain mail services require the FROM name to be the same as the username that is authenticated to send mail and will not send if the FROM is the usernm. See do_command.c line 432.
in the sendmail interface used by cron to send job output, the header sender (From will default to the authenticated user. would your needs be met if this header sender was not transmitted, thus invoking the sendmail default?
i ask, because a MAILFROM variable would be wrong often, leading to either forged or lost email, and such a feature would be unpopular among system administrators. but, excluding the From: header would be fine, and i could add a setting for that.
I assume the sendmail default would be just fine. I only asked about MAILFROM because other forks like cronie use it.
:-). for the record, this is not a fork. anyway if MAILFROM is in common use we should probably adopt it here. do you have ambition to submit a pull request that includes both code and documentation changes? if not i'll look for a round tuit.
I didn't mean to imply this was a fork -- I meant to imply forks of this software have it. However, I'm not sure it is common use. If you search for MAILFROM in the context of cron or crontab, it's hard to find. I think your suggestion could be just as helpful to allow for the use of the default sendmail header sender. I actually found MAILFROM by accident because of my issue with using Ubuntu Server and Nullmailer sending to Microsoft Exchange.
Unfortunately, I do not have the knowledge of C, or I would absolutely submit a PR.
can you extract the documentation which defines MAILFROM and post it here?
Just passing, checking for known issues for a Cygwin user, so thought I'd supply: man7 5 crontab
Otherwise, mail is sent to the owner of the crontab. This option is useful if you decide to use /bin/mail instead of /usr/lib/sendmail as your mailer. Note that /bin/mail does not provide aliasing and UUCP usually does not read its mail. If MAILFROM is defined (and non-empty), it is used as the envelope sender address, otherwise, ``root'' is used. (Note: Both MAILFROM and MAILTO variables are expanded, so setting them as in the following example works as expected: [email protected] ($USER is replaced by the system user) )