Using Mailto in Crontab
Crontab file stores the instructions to be used by the cron daemon in a Unix System. While the format of the entries is known to many unix administrators a regular question arises on how to use the various environment variables of Cron including the MAILTO variable.
MAILTO variable in Cron is used by the cron daemon if it has any reason to send mail as a result of running the commands in the local crontab. There are various scenarios to be considered wrt MAILTO command.
[LIST=1][*]MAILTO defined but value is empty : If a MAILTO variable is defined in the crontab but the value is left empty, Cron Daemon will not attempt to send an email[*]MAILTO defined but value is not empty : Cron Daemon will attempt to send the mail to the address defined in the MAILTO variable[*]Crontab doesnt have a MAILTO variable : Cron Daemon will send the intended mail to the local owner of the crontab.[/LIST]Example Crontab File from my Linux System. The MAILTO and features of crontab vary between variants of Unix, please let us know if you have been successful in sending the results of a crontab execution to a different system user on your variant of Linux.
[FONT=Courier New]#My Cron file.. User:MySQL
#use /bin/sh to run commands, overriding the default [/FONT][FONT=Courier New]SHELL=/bin/sh
# mail any output to `dba'
# fifteen minutes after midnight.. Backup it Up !!!
15 0 * * * $HOME/bin/backup.job >> $HOME/backup.out 2>&1[/FONT]