A Little Email Testing Script
Wondering if your PHP scripts are sending email? Here's a quick test.
Copy the code below, save it as mymailtest.php, and upload it to your server. Verify the email address you specified in the code is, in fact, correct.
When mymailtest.php has been uploaded to your server, type its URL into your browser.
The PHP script will attempt to send an email with the mail() function.
After the email is sent (which is quick), the browser prints the word DONE.
<?php
// Between the quote marks, specify the email address
// where the test email is to be sent to.
$EmailAddressForTest = "name@example.com";
// No other customization required.
$subject = "Email test";
$body = "Email test from {$_SERVER['PHP_SELF']}";
$from = "From: $EmailAddressForTest";
mail($EmailAddressForTest,$subject,$body,$from);
?>DONE
Note that even if the script sends the email, spam and other filters may be putting your email where you're not finding it. Therefore, if you can, use an email address that encounters a minimum of spam filtering.
If the specified email address is to a mailbox at your own domain and you're not receiving the email, try turning filters off momentarily and run the test again.
If you need to use an online email service, Gmail has generally been pretty good in detecting real spam. But they have their moments like most online email services do.
Will Bontrager