Debugging Email Sent With a PHP Script
To debug, the first thing to do is verify the email address is correctly typed in the script you're using to send the email. Sometimes a person will miss a typo after looking at the same thing enough times. So copy the email address and paste it into your regular email sending software and send a test email and verify it is received.
The next thing is to use the A Little Email Testing Script to send a test email.
If the test email does not arrive, the reason you didn't receive the email may be one of these:
-
The email may have been sent but got caught in spam filters. (If you control the filter where it got caught, you can change the filter. Otherwise, the only way I know of to pass the filter is to change the email into something that will pass.)
-
If your hosting company imposes email sending limits, the email might not have been sent because you've already reached the email-sending limit for that day (or hour or however they enforce limits).
-
The hosting company might not allow use of the PHP mail() function. (Yes, I have run into those.)
If the test email does arrive, then the email sent by the first script you used was likely caught in spam filters.
As noted further above, if the filter is in your control, you can change it, but otherwise the email needs to be changed so it will pass the filter.
Generally, finding out how to pass a spam filter requires trial and error.
The PHP mail() function used by PHP to send email works (unless the hosting company has configured PHP in a way that prevents it from working). Therefore, when email doesn't arrive it generally is because either the destination email address is incorrect or the email was caught in spam filters.
Will Bontrager