I'm building a PHP server backup script that sends me an email if errors occur. Now I have this code:
if (mail("[email protected]", "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??
Your problem is that the web host thinks that it should deliver emails for every [email protected] 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