Hi, Can you help, I'm going around in circles here...
I'm running PHP 4.3.8 on a Windows XP box.
I can sucessfully send myself HTML emails using the code below... ($message is a load of HTML script)
$headers = "";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=ISO 8859-1\n";
$headers .= "From: test@example.co.uk<test@example.co.uk>\n";
mail( "test@example.co.uk", "Order Confirmation",$message, $headers );
But when I try to get clever with the headers to give a text alternative to HTML all I get is an email with a blank message, any idea why... the problem code is below...
$boundary = uniqid("DS"); //unique boundary
$headers .= "From: test@example.co.uk<test@example.co.uk>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary = $boundary\n\n";
$headers .= "This is a MIME encoded message.\n\n"; //message to people with clients who don't understand MIME
$headers .= "--$boundary\nContent-Type: text/plain; charset=ISO-8859-1\n";
$headers .="Content-Transfer-Encoding: 7bit\n\n";
$headers .= "Delphi Solutions Invoice";
$headers .= "--$boundary\nContent-Type: text/html; charset=ISO-8859-1\n";
$headers .="Content-Transfer-Encoding: 7bit\n\n";
$headers .= $message;
$headers .= "--$boundary--";
mail( "test@example.co.uk", "Order Confirmation","", $headers );
(p.s. I know I should use base64_encode() for the content transfer encoding once I get the script working. Also, I tried using /r/n, but that doesn't work even with my basic message under windows. I have based this code on several examples I've seen around on the internet)
[edited by: coopster at 6:35 pm (utc) on Sep. 2, 2004]
[edit reason] examplified URL per TOS [webmasterworld.com] [/edit]