[CentOS] use of MAILTO variable in crontab

Wed Jul 13 19:03:40 UTC 2011
Michael Best <mbest at pendragon.org>

On 07/13/2011 12:37 PM, James B. Byrne wrote:
> I want to do something like this:
>
> 30 2 * * * MAILTO=testaddr at harte-lyne.ca; echo "this should be mailed"
>
> I have searched extensively and from what I have read I believe that
> this should work.  But evidently I misapprehend how cron and MAILTO
> is supposed to work as my example does not cause any mail to be sent
> as far as I can determine from maillog.
>
> How does one specify unique MAILTOs for different cron jobs where
> the desired recipient is not the user that runs the cron job?

Like this:

MAILTO=testaddr at harte-lyne.ca
30 2 * * * echo "this should be mailed"

-Mike