How to make the cron send an error message know that if MAILTO is set, cron will send the task output to the specified mailbox. However, if you only want to receive an error alert email, that is, if the task is not sent during normal execution, but only when an error occurs, how can this problem be achieved? The method is simple. Specify the standard output of the task as/dev/null. MAILTO = mybox@gmail.com0 1 ** 1 script. sh>/dev/null principle: MAILTO sends all output of the task to the specified mailbox by default. Anyone familiar with linux/unix knows that the default output includes standard output and error output. Therefore, MAILTO directs both standard output and error output to the mail service. When we manually direct the standard output to/dev/null, the mail service will not be enabled normally, but the mail service will be started only when the error output contains content.