cron icon indicating copy to clipboard operation
cron copied to clipboard

Add MAILFROM parameter

Open vitalibertas opened this issue 4 years ago • 6 comments

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.

vitalibertas avatar Nov 11 '21 21:11 vitalibertas

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.

vixie avatar Nov 12 '21 16:11 vixie

I assume the sendmail default would be just fine. I only asked about MAILFROM because other forks like cronie use it.

vitalibertas avatar Nov 12 '21 17:11 vitalibertas

:-). 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.

vixie avatar Nov 12 '21 19:11 vixie

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.

vitalibertas avatar Nov 12 '21 19:11 vitalibertas

can you extract the documentation which defines MAILFROM and post it here?

vixie avatar Jan 29 '23 03:01 vixie

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) )

BrianInglis avatar May 24 '23 02:05 BrianInglis