Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have setup cronjob for the root user. However when the cron fail I should receive an email from the cronjob because I have set MAILTO like this in /etc/crontab :

I have installed mailx using

yum install mailx

But when I look at the cron log I get these lines :

Feb 23 14:13:01 internal crond[6858]: (root) CMD (/var/www/vded/build/bin/
Feb 23 14:13:01 internal crond[6857]: (root) MAIL (mailed 79 bytes of output but got status 0x0001 )

How can I fix this?


  • I installed mailx and sendmail using yum.
  • I started sendmail.
  • So now sending an email is working from the command line!

I get this error in the maillog :

Feb 23 16:06:01 internal sendmail[7210]: o1NG61cd007210: from=root, size=425, class=0, nrcpts=1, msgid=<>, relay=root@localhost
Feb 23 16:06:01 internal sendmail[7211]: o1NG61hT007211: from=<>, size=732, class=0, nrcpts=1, msgid=<>, proto=ESMTP, daemon=MTA, relay=localhost []
Feb 23 16:06:01 internal sendmail[7210]: o1NG61cd007210: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30425, relay=[] [], dsn=2.0.0, stat=Sent (o1NG61hT007211 Message accepted for delivery)
Feb 23 16:06:01 internal sendmail[7212]: o1NG61hT007211: to=<>, ctladdr=<> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30972, dsn=2.0.0, stat=Sent is the name of the server.


So in fact if I put the as the first line of my crontab (using crontab -e) it is working.

Why is it not working by setting the MAILTO in /etc/crontab ?


share|improve this question
What do the logs from your mail server say? How is mailx configured to send mail? – Bill Weiss Feb 23 '10 at 14:36
Also, try sending something manually using mailx and compare the resulting logs on the mail server. – Chris S Feb 23 '10 at 14:50
/var/log/maillog is empty I haven't configured mailx – benjisail Feb 23 '10 at 14:50
Can you send mail from the command line? – Dennis Williamson Feb 23 '10 at 14:50
Could you answer the recommendations mentioned here first, please? Try sending a mail from the command line, please. – DaDaDom Feb 23 '10 at 15:22
up vote 5 down vote accepted

So to answer my question :

  • Install mailx yum install mailx
  • Install sendmail yum install sendmail
  • Start sendmail
  • Put the MAILTO line into the crontab using crontab -e : and not in /etc/crontab
share|improve this answer
I just noticed on CentOS 6.5 (w/cronie) that /etc/crontab does not specify defaults.… – Adam Monsen Apr 24 '14 at 19:09
Short and simple – Abhishek Madhani Dec 14 '15 at 15:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.