If you are using a maintainance user executing scheduled cronjobs, maybe you’ve found yourself needing to report the result of these jobs to different email addresses. Everyone knows for sure the MAILTO parameter, as explained in the crontab(5) manpages.
But maybe you don’t know that MAILTO is interpreted sequencially, when it’s found, so you can have different recipients in the same crontab, like in this example:
* * * * * echo "abc"
* * * * * echo “dfe”
so user1 will get mailed with “abc” and user2 with “dfe”.
It works in the standard “cron” program, so for example you can use this tip in Debian or FreeBSD (and in other Unices to, I guess)
3 thoughts on “Cron and multiple recipients”
what if I want to have multiple recipient for the same command? must I use similiar method, multiple MAILTO line?
Different Cron daemons vary, but you should be able to specify multiple email recipients by separating them with commas.
“man 5 crontab” is your friend! The answer’s in there.