Cron Daemon FROM header

I wanted to do something simple. My cron emails had a FROM header:

Cron Daemon <root@hostname>

And I wanted to change this to

Hostname Cron Daemon <root@hostname>

so I could see this easily in the mail list.

It turns out that cron does not let you configure this anywhere. If you really want to do this, your have to turn off cron's mail feature and pipe custom headers along with the output of your script into a different email system, e.g.,


...get your scripts to print out a to, from and subject line at the top of their output containing the information you want. eg

To: your at mailbox.com
From: scriptname at hostname.com
Subject: scriptname, hostname

other script output

Then in the cron pipe the output into sendmail with the t flag

1 1 * * * somescript 2>&1 | /usr/sbin/sendmail -t

ref: http://lists.freebsd.org/pipermail/freebsd-questions/2009-October/207174...

Another idea is to use a non-root user to run the job, and configure the Full Name field of /etc/password to be the display name you want. Bleah.