[PHP] Multipart Email Problem

2004-06-24 Thread Matt MacLeod
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 [EMAIL PROTECTED];
   $from=Vinciane Rycroft [EMAIL PROTECTED];
   $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.;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Multipart Email Problem

2004-06-24 Thread Alister Bulman
On Thu, 24 Jun 2004 12:27:17 +0100, Matt MacLeod [EMAIL PROTECTED] wrote:
 
 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.

Sorting out the MIME headers is not easy.

So user http://pear.php.net/package/Mail_Mime to do the hard work.

Alister

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipart Email Problem

2004-06-24 Thread Paul Bissex
I had the same problem a few months ago. I switched to Mail::mime
thinking that the problem was my homebrew code, but still the same
thing -- Outlook didn't recognize the message as multipart.

The fix was changing the newline sequence from \r\n to \n.

The Mail::mime constructor allows you to change this value, so in my
code the change boiled down to:

  $mime = new Mail_mime (\n);

Hope this works for you.

pb





On Thu, 24 Jun 2004 12:27:17 +0100, Matt MacLeod [EMAIL PROTECTED] wrote:
 
 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.

[snip]
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php