Hello,
I am sending an html message with and embedded image using the following code:
// Read message from html template
$message = fread("template.html", filesize("template.html"));
// I replace the values in $message that are necessary to
// fill the tempalte
...
// Generate a boundary string
$rand_value = md5(time());
$mime_boundary = "-----$rand_value";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: Name <[email protected]>\r\n";
$headers .= "Reply-To: Name <[email protected]>\r\n";
$headers .= "Return-Path: [email protected]\r\n";
$headers .= "Organization: Name\r\n";
$headers .= "X-Mailer: PHP's mail() Function\r\n";
$headers .= "Content-Type: multipart/related; ";
$headers .= "boundary=\"$mime_boundary\"; type=\"text/html\"\r\n\r\n";
$body = "This is a multi-part message in MIME format.\r\n";
$body .= "--$mime_boundary\r\n";
$body .= "Content-Type: text/html; charset=UTF-8\r\n";
$body .= "Content-Transfer-Encoding: 7bit\r\n\r\n$message\r\n\r\n";
$body .= "--$mime_boundary\r\n";
$body .= "Content-Type: image/jpg\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-ID: <ggtourslogo>\r\n\r\n";
$body .=
chunk_split(base64_encode(file_get_contents("./templates/emaillogo.jpg")));
$body .= "--$mime_boundary--";
return mail("[email protected]", "Subject", $body, $headers);
However when it is send to a hotmail.com address the message is received blank.
It does work fine with Gmail, Yahoo mail, Outlook Express and Thunderbird.
Your help is much appreciated.
Fernando
_________________________________________________________________
We are your photos. Share us now with Windows Live Photos.
http://go.microsoft.com/?linkid=9666047