I have a website that is hosted by GoDaddy on a virtual dedicated platform, and I haven’t been able to get the mail() function to work properly in my PHP script. I’m trying to send emails with validation codes to people when they first sign up to my website, and the mail() function works great for Gmail address, but not others like AOL or even GoDaddy’s email service!
I tried talking with multiple GoDaddy support reps but they weren’t really helpful on the issue. I’ve looked around online and it seems like this is a very common problem with people who are hosting their websites on GoDaddy. I’m not getting bounce back emails when I the emails fail so it’s hard to know what’s going on.
Here is my PHP code:
$sendtoemail = 'newsignup@aol.com';
$emailsubject = "Please validate your email";
$emailbody = "Validation info, blah blah.";
$emailheader = 'From: admin@example.com' . "\r\n" .
'X-Mailer: PHP' . "\r\n" .
'Reply-To: admin@example.com' . "\r\n" .
'-fadmin@example.com';
mail($sendtoemail, $emailsubject, $emailbody, $emailheader);
I’ve gotten a few errors when I checked /usr/local/psa/var/log/maillog (accessed through PuTTY SSH) that all ended in: deferral: ./Maildir:_No_such_file_or_directory/
I have also activated reverse DNS on my hosting account and created an SPF DNS record that sends email through “GoDaddy only” and checked the “Include PTR” box for DNS lookup. This was under the “TXT (text)” section of the “Zone File Editor” on GoDaddy’s DNS manager. (Hopefully that makes more sense to you than it does to me).
I am not sure if GoDaddy support PHP Mail, this is usually a big problem for web hosting companies because its used in scripts to send spam.
The best thing to do is check what PEAR extensions GoDaddy have on there hosting, if they have PEAR mail, you can use that. If not, then you should try using authenticated mail sending.
I can give you an example of PEAR and Authenticated mail if you need.