I am trying to develop a multipart/alternative email to send both HTML and Plain Text versions.
From everything i've read in this forum and other resources, I have developed the following code:
$bodyt = "Plain Text Content";
$bodyh = "<p><b>HTML Content</b></p>";
$semi_rand = md5(time());
$mime_boundary = "==MULTIPART_BOUNDARY_$semi_rand";
$to = "$to_mail";
$subject = "Email Subject";
$body = "
--$mime_boundary
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
$bodyt
--$mime_boundary
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
$bodyh
--$mime_boundary--";
$headers = "From: info@website.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/alternative;\r\n" .
" boundary=" . $mime_boundary;
mail($to,$subject,$body,$headers);
The email is sent, but I receive a blank email with no content. Any suggestions? Help is always appreciated.