Multipart Email Problem

From: Date: Thu, 24 Jun 2004 11:27:17 +0000
Subject: Multipart Email Problem
Groups: php.general 
Request: Send a blank email to php-general+get-188940@lists.php.net to get a copy of this message
I have a script that sends a multipart email from a php page. The script appears to work fine on my mail client (Mail on Mac OSX) and on an online email reader (mail2web.com). However a colleague using Outlook on Windows 2003 views the whole email (ie the raw code - both the text only and the HTML) and when I sent an email to his hotmail account, hotmail simply displayed a blank page. My client is getting quite frantic about this so if anyone has any suggestions, I'd be very grateful. This is the script I am using: $to="Matt MacLeod <matt@bigbarn.co.uk>"; $from="Vinciane Rycroft <vinciane@london21.org>"; $subject="London 21 Newsletter"; $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; $headers = "From: $from\r\n" .
      "MIME-Version: 1.0\r\n" .
      "Content-Type:multipart/alternative;\n" .
      " boundary=\"{$mime_boundary}\r\n\"";
$headers.= "From: $from\r\n"; $message = "This is a multi-part message in MIME format.\n\n" .
      "--{$mime_boundary}\n" .
      "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
      "Content-Transfer-Encoding: 7bit\n\n" .
      $nonhtml ."\n" .
      "--{$mime_boundary}\n" .
      "Content-Type: text/html; charset=\"iso-8859-1\"\n" .
      "Content-Transfer-Encoding: 7bit\n\n" .
      $htmlVersion;
if (mail($to, $subject, $message, $headers))
      echo "Message Sent!";
else
      echo "Failed to send message.";


« previous php.general (#188940) next »