Saturday, June 13, 2009

PHP mail() returns False on website hosted at Yahoo

Noticed this problem when I used my favorite form2mail script on a website hosted at Yahoo. (small business hosting). The mail function was always returning False. After debugging the problem I reached the conclusion that it was something in the additional_headers argument that was causing the error. If I removed that argument, the mail function would work.

Then I came across this Yahoo article which explains why I was getting the problem.

Yahoo correctly tries to enforce that the From: address in the header is set to an email address within YOUR DOMAIN only. So for example, if your website is www.foodoo.com, then the From: address must be something like info@foodoo.com. It cannot be info@somethingelse.com because doing that will allow spammers to misuse it!

No comments: