I am sending a very simple HTML message using PHP mail(). The purpose was to send a link that contained the user's email address and a verification code. When the user clicked the link, the site would receive the email address and code to verify that the user's email address was accurate.
At first, it worked, when it was nothing more than the HTML/BODY tags, a header, and the Verify Email link. I sent the email several times while debugging the verification process. Then I made what I considered to be minor changes, and it quit working. The minor changes are commented out as shown. I added an image and a couple lines of text.
It's not sending emails anymore, and I get no warnings or errors. I have removed the image, the extra text and commented out the addition of the link, but it will still not work. Can anyone see what I'm doing wrong? (I've changed names to protect the innocent.)
function sendEmail($email, $code) {
$email = str_replace("@","%40",$email);
$to = $email;
$subject = 'Email Verification';
$headers = "From: " . strip_tags('someone@somewhere.com') . "\r\n";
$headers .= "CC: \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = "<html><body>\r\n";
$message .= "<h2>Thank you!</h2>\r\n";
//$message .= '<img src="http://www.mytestwebsite.com/images/logo.png"><br>';
//$message .= 'Thank you for registering an account with us. ';
//$message .= 'Please verify your email address by clicking the button below.<br>';
//$message .= '<a href="http://www.mytestwebsite.com/verifyemail.php?email='.$email.'&code='.$code.'">Verify Email</a>';
$message .= "</body></html>\r\n";
$message = wordwrap($message, 70, "\r\n");
mail($to, $subject, $message, $headers);
}
How can I find out what's wrong with my setup? Is there a website that would display the errors in my code?
Thanks for your help! SH