I've setup crons through cPanel for a long time and the output is always emailed to me. However, I need a cron to run with root permissions and so I added something like this to crontab:
5 0,12,8,20 * * * php /path/to/file.php 2>&1 | mail -s "my cron job" my@email.com
The command executes and I receive an email, but the output is attached as a file ironically named noname
.
How can I get the output to show up in the body of the email instead of in an attached file?