Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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'm building a PHP server backup script that sends me an email if errors occur. Now I have this code:

  if (mail("", "ERRRORRSSSS", "hello:)")) {
     echo("<p>Message successfully sent!</p>");
    } else {
     echo("<p>Message delivery failed...</p>");

when I run it on the command line Iget the "message successfully sent" message, but nothing appears in my mail box (or spam folder)

Here's some more info...

php -i |grep mail
mail.force_extra_parameters => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
Path to sendmail => /usr/sbin/sendmail -t -i
MAIL => /var/spool/mail/root
_SERVER["MAIL"] => /var/spool/mail/root
_ENV["MAIL"] => /var/spool/mail/root

Any ideas??

share|improve this question
Is sendmail correctly configured? Have you been able to send email from that box in the past, using tools that are not PHP? – cjc Mar 17 '12 at 16:00
up vote 1 down vote accepted

Your problem is that the web host thinks that it should deliver emails for every locally, while in fact mail for should be delivered elsewhere.

See this answer on ServerFault on what you may try to do to solve this

share|improve this answer
I discovered that when I changed the recipient address to my gmail address it worked. Clearly the problem was something to do with the fact that the original recipient mail account is also hosted on the same box. Thanks very much – Xoundboy Mar 18 '12 at 9:02

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.