|  | Posted by Gernot Frisch on 12/13/06 13:18 
Complete example that *should* work, but does not.It used to work, but now it does not anymore... _sigh_
 
 
 <?php
 $mail_to = xy@mydomain.com; // address exists
 $mail_from = "xy@mydomain.com";
 //add From: header
 $headers = "From: ${mail_from}\r\n";
 
 //specify MIME version 1.0
 $headers .= "MIME-Version: 1.0\r\n";
 // might need unique id
 $headers .= "Message-ID: <".md5(time)."@mydomain.com>\r\n";
 
 //unique boundary
 $boundary = '--==Multipart_Boundary_x'.md5(time()).'x';
 
 //tell e-mail client this e-mail contains//alternate versions
 $headers .= "Content-Type: multipart/mixed; boundary =
 \"$boundary\"\r\n\r\n";
 
 //plain text version of message
 $body = "--$boundary\r\n" .
 "Content-Type: text/plain; charset=ISO-8859-1\r\n" .
 "Content-Transfer-Encoding: base64\r\n\r\n";
 $body .= chunk_split(base64_encode("This is the plain text
 version!"));
 
 //HTML version of message
 $body .= "--$boundary\r\n" .
 "Content-Type: text/html; charset=ISO-8859-1\r\n" .
 "Content-Transfer-Encoding: base64\r\n\r\n";
 $body .= chunk_split(base64_encode("This the <b>HTML</b>
 version!"));
 
 // Finish?
 $body .= $boundary.'--';
 
 //send message
 echo "sending mail: <br>";
 echo mail($mail_to, "An HTML Message", $body, $headers);
 ?>
  Navigation: [Reply to this message] |