Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

CentOS 5

I have setup /etc/crontab MAILTO=my@email.com and can get emails with outputs whenever any tasks run by crond. But if I use mail program send email to same email, I CAN'T receive the email. (with command this: mail -s "test email" "my@email.com") Is there any way to check what's happened?

Below is what is working and not:

  • crond can send email to my@email.com (this is just an example, I actually sending to company email)

  • mail can send email to gmail/yahoo/hotmail account

  • mail CAN'T send email to my@email.com

share|improve this question
    
It would be helpful if you posted error messages or log messages. Are you getting reject responses? What does type -a mail (Bash) tell you? –  Dennis Williamson Oct 14 '10 at 14:06

2 Answers 2

up vote 2 down vote accepted

If mail can send to a gmail account, there are mails leaving. In the logs (possibly in /var/log/maillog) you should see, whether your mails to your company are leaving or not. Dependend on that, one has to think about the difference in the path of the mails, which arrive and those which don't.

share|improve this answer

make sure your crons have PATH set or us the absolute path on mail, also need to make sure that your mail server will accept email from this host (may be blocked since it could appear as a spam box)

share|improve this answer
1  
the cron mailler is called in a different place from where ever your script calls mail, so it has different path info –  Jimsmithkka Oct 14 '10 at 11:21

Your Answer

 
discard

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.