I wrote a php routine not long ago to send an HTML email for the purposes of email verification.
In it was an img tag using a logo from the internet, followed by "Thank you, click the button below to verify your email address." I had some trouble at first, but you guys straightened me out on it (Sending HTML mail not working). When I got the answer, I kicked myself for not seeing it myself.
Using what I learned, I tried something similar on a different project. Only this time I used an image from my website's folder. It would not send. If I took out my image and put in the old image, it would work. If I put in both images, it would work. If I took out the old image, it would fail. If I took out both of the images, it would work. Thinking that it might be a line length issue the email server was choking on (the local image had a long file name, though the path was short), I shortened the name of the image file. It still failed. I changed the name of the image file again by a few characters, and it failed. It seems like this new image is cursed.
I'm having some problems again with a different email. I can't give the full text of the code without revealing client info that should be protected. But I am going to include some so you can see that I'm trying to keep line lengths under 70 characters.
function sendVerificationEmail($email, $verificationcode) {
$email2 = str_replace("@","%40",$email);
$to = $email;
$subject = 'aaaa bbbbb ccccc Validation'; //text replaced to protect client and maintain line lengths...
$headers = "From: " . strip_tags('dddddd@eeee.org') . "\r\n";
$headers .= "Reply-To: ". strip_tags('dddddd@eeee.org') . "\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 .= "test#10<br>\r\n";
//$message .= "<img src='http://www.012345678901234.com/eeee/images/eeeelogo_short.png'>";
//$message .= "<img src='http://www.012345678901234.com/eeee/images/eeeelogo.png'>";
//$message .= '<img src="http://www.ffffffff.com/22221111004444/assets/images/logo.png"><br>';
$message .= "\r\n<h2>Thank you!</h2>\r\n";
$message .= 'Thank you for registering an account with gggg hhhhh iiiiii! ';
$message .= 'Please verify your email address by clicking the button below.<br><br>';
$message .= '<a href="http://www.012345678901234.com/eeee/verifyemail.php?email='.$email2.'&code='.$verificationcode.'"><img src="http://www.012345678901234.com/images/verifyemail.png"></a>';
$message .= "</body></html>\r\n";
$message = wordwrap($message, 70, "\r\n");
mail($to, $subject, $message, $headers);
}
The second and third items commented out are my problem images. What do you suggest I look at first?
SH