moonvalley
New Member
I am trying to send a multipart/alternative mail in PHP, so that a receiver without HTML mail support can get the plain text version. I can receive the email with the following code, but the content is empty. Can someone please help?
--------------------------------------------------------------------------------
<!DOCTYPE html><html><head></head>
<body><?php
// This creates a random hash for the boundary string
$boundary=md5(time());
$msg="
If you can see this then your client doesn’t accept MIME types!
--$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
This is the simple, alternative mail.
--$boundary
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
<h1>This is the HTML mail.</h1>
--$boundary--
";
mail("fragment_shader@yahoo.com",
"Test 3",
$msg,
"Content-type: multipart/alternative; boundary=\"$boundary\"");
?> </body></html>
--------------------------------------------------------------------------------
<!DOCTYPE html><html><head></head>
<body><?php
// This creates a random hash for the boundary string
$boundary=md5(time());
$msg="
If you can see this then your client doesn’t accept MIME types!
--$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
This is the simple, alternative mail.
--$boundary
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
<h1>This is the HTML mail.</h1>
--$boundary--
";
mail("fragment_shader@yahoo.com",
"Test 3",
$msg,
"Content-type: multipart/alternative; boundary=\"$boundary\"");
?> </body></html>