To get an email every time a cron job, you have scheduled to run, fails:
Redirect all of your standard output to
/dev/null or to some file.
MAILTO environment variable with a list (comma separated) of all the email addresses you want to receive the email notifications.
To avoid using the same value of MAILTO for every task you run, you can just write it in the crontab e.g.:
0 5 * * * /bin/some_script > /dev/null
MAILTO="firstname.lastname@example.org" to the top of a crontab will cause any output from the cron job to be emailed. So we redirect the STDOUT to null and if any STDERR messages are present, they will get emailed to you.