hi all,
I have a script to send newsletters both in html and text version, all
works fine in email clients but unfortunately not in yahoo mail: it
shows nothing in the body of the message, however if I forward that
mail from yahoo I can see it perfectly again in outlook/eudora.
By some trial and errors I found that without the first 2 headers, it
works fine in yahoo mail too, so what's wrong with my headers ?
Thanks in advance to who can help me about that .
johnny
here's the code ( the relevant part )
// create boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// HEADERS
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative;\n".
" boundary=\"{$mime_boundary}\"";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: me<me@mysite.com>\r\n";
$headers .= "X-Sender: me<me@mysite.com>\n";
$headers .= "Reply-To: me<me@mysite.com>\r\n";
$headers .= "Return-Path: me<me@mysite.com>\n";
$query = mysql_query("SELECT id, email FROM $table ", $db);
while ($to = mysql_fetch_array($query)) {
$recipient = $to[email];
$message_html = 'some HTML here ';
$message_text = ' some text here ';
// MESSAGE TO BE SENT
$message = "This is a MIME message \n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message_text."\n".
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message_html."\n".
"--{$mime_boundary}--\n";
@mail ($recipient, $subject, $message, $headers );
}
?>