Problems send MIME multipart/alternative mail with php

From: Date: Tue, 19 Aug 2003 19:56:21 +0000
Subject: Problems send MIME multipart/alternative mail with php
Groups: php.general 
Request: Send a blank email to php-general+get-160071@lists.php.net to get a copy of this message
I have had no success sending multipart/alternative emails with php. I have tried everyone's various code snippets with no luck. I test the results with Outlook and Outlook Express. Everytime my boundary tag ends up showing as part of my message and thus the plain text and html portions show up as one long blob of unformatted text. Below is the code I am currently using. Any suggestions would be greatly appreciated. Thanks, Dan The code: <?php error_reporting(E_ALL); //FUNCTION future multipartmailer($to,$from,$subject,$plaintextsource,$htmlsource); //$boundry="**=-=-=D-=-=-=-MIME-A-Boundry-=-=-N=-=-=-**"; $boundry= "---=".uniqid("MAILDIVIDERS"); //set mime type $headers="From: Person <ppersom@mail.com>\n"; $headers.= "MIME-Version: 1.0\n"; $headers.="Content-Type: multipart/alternative; boundary=\"$boundry\"\n"; //these files have the raw message content $plaintext = file("plaintextcontent.txt"); $html = file("htmlcontent.txt"); //warning for non-MIME lovin' clients $headers .= "This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.\n\r\n\r"; // CHOP $message .= $boundry."\n"; $message .= "Content-Type: text/plain; charset=ISO-8859-1\n"; $message .= "Content-Transfer-Encoding: 8bit\n\r"; foreach($plaintext as $line) {     $message .=$line; } $message .="\n".$boundry."\n"; $message .= "Content-Type: text/html; charset=ISO-8859-1\n"; $message .= "Content-Transfer-Encoding: 8bit\n"; foreach($html as $line) {     $message .=$line; } $message .="\n".$boundry."\n"; mail("me@me.com","Welcome to the Website",$message,$headers); print $headers."".$message."<br>"; ?> </body> </html

« previous php.general (#160071) next »