This question already has an answer here:
I'm having a strange problem here with crontab. I have set up the crontab correctly to run the cron job as follows:
[user@user ~]$ crontab -e SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTOfirstname.lastname@example.org HOME=/ 2 * * * * php usr/share/nginx/html/site/script.php
The script runs, I know this because the script is just a basic test that uses the mail() function to let me know it ran.
But I do not get the e-mail from crontab to let me know the script has ran. I should be getting an output e-mail to the MAILTO address above but I am not. I have even tried with quotes around the address.
There's nothing wrong with Sendmail because otherwise the script wouldn't be able to send an e-mail. There's nothing wrong with the e-mail address either because the mail() code in script.php sends to the same e-mail address.
Technically I could just send the e-mail output myself this way rather than rely on crontab but I know that's not the right way to do it.
Any idea where I am going wrong?
PS. This is a Centos 6.3 server.