mailto crontab doesn't work

Simon Lenz picture Simon Lenz · Mar 25, 2011 · Viewed 39.2k times · Source

I'm running a script on my mybookworld(NAS) via crontab every day. And it would be nice if it could send me everyday an email report with the output of the script.

So I looked at MAILTO in crontabs, but it doesn't send me anything at all. The script ran correctly at the right time, but there was no email. This is my crontab:

~ # crontab -l
[email protected]

0 0 * * * python /root/erepCrawler/src/main.py

I've written a "smaller" crontab for testing reasons:

[email protected]
* * * * * echo "blaah"

This should send me every minute an email with "blaah" as the body. If I'm wrong please correct me.

Is there another package needed for sending mails with crontab? sendmail is installed in /opt/sbin/sendmail.

Answer

Scherbius.com picture Scherbius.com · Mar 26, 2011

It should work in the cron with following modifications:

MAILTO="[email protected]"
* * * * * echo blaah

works on my server, just tested.