0

I'm building a PHP server backup script that sends me an email if errors occur. Now I have this code:

  if (mail("me@mydomain.com", "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??

Xoundboy
  • 593
  • 1
  • 9
  • 20
  • 1
    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

1 Answers1

1

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

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

adamo
  • 6,867
  • 3
  • 29
  • 58
  • 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 09:02