PHP Sendmail & Cpanel Tip
I've noticed fairly recently that when using php to send an email (with a script using mail() ) it does not work. It looks like the email has been sent but infact the email has not been sent. Whats confusing is their is no error message which does suggest that it has worked.
Now I may have found (or at least it works for me) two ways you can check to solve the problem.
I was using cPanel 10, but I'm now on CP 11. I think from CP 10 they have changed the way sending email through php by making sure the account does exist. Maybe it's a bug or not we will have to wait and see, unless anyone can shed some light.
- Make sure the message within the script starts and ends with double quotes "message goes here". I think the email address does not matter too much, but try either single or double.
- This will not be obvious and it took me two days and another web host to figure out this. After checking the above the email was still not sent. The problem was that the email account I was using did not exist, so I made one through cPanel and bingo it worked.