Outlook and Hotmail seem to be quite happy to show the page as intended, but Netscape mail seems to be a bit lost.
My embedding method is basically the following, though if the same mail loads perfectly with outlook, I'm not sure what I can change that will fix this without breaking the other.
Anyhow ...
Code: Select all
// Process HTML Email Body
if (preg_match_all("/<img(.*?)>/si", $html_body, $matches)) {
for($i=0; $i<count($matches[0]); $i++) {
// find and retain all important parameters for current link
if(preg_match_all("/(height=['\"]|width=['\"]|class=['\"])(\S+?)['\"]/i", $matches[0][$i], $parameters)) {
$parameters = " " . implode(" ", $parameters[0]);
} else {
$parameters = "";
}
// find and process the src - link each unique image once and set reference
if(preg_match("/src=['\"](\S+?)['\"]/i", $matches[0][$i], $full_path)) {
$prev_used = false;
// Check each src against the previous ones to make sure the same image isn't linked twice
for($x=0; $x<$i; $x++) {
preg_match("/src=['\"](\S+?)['\"]/i", $matches[0][$x], $test_var);
if ($full_path[1] == $test_var[1]) {
$prev_used = true;
break;
}
}
// Link all unique entries. Non unique ones are linked to the previously found link.
if (!$prev_used) {
$URL = explode("/", $full_path[1]);
$mail->AddEmbeddedImage(PATH_LOCAL . "includes/email/e_images/" . $URL[count($URL)-1], "my-attach-" . $x, $URL[count($URL)-1]);
}
}
// replace the original img with the new tags, including any other tags found
$alt_name = explode("/", $full_path[1]);
$alt_name = $alt_name[count($alt_name)-1];
$html_body = str_replace($matches[0][$i], '<img alt="' . $alt_name . '" src="cid:my-attach-' . $x . '"' . $parameters . '>', $html_body);
}
}Any help appreciated. Cheers
d11wtq | Please use
Code: Select all
tags - you should know this by now [/color]