views:

93

answers:

1

I have a script set up to send out multipart emails; plain text and html messages. The HTML messages work just fine, but when I used an email client that only does plain text the plaint text message does not render and I get the following:

--
This message was generated automatically by Me
http://www.somewebsite.com/


$html_msg = $message_details;
$plain_text_msg = strip_tags($message_details);

$headers = <<<HEADERS
From: Me <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="==PHP-alt$mime_boundary"
HEADERS;

// Use our boundary string to create plain text and HTML versions
$message = <<<MESSAGE

--==PHP-alt$mime_boundary
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

$plain_text_msg

--
This message was generated automatically by Me
http://www.somewebsite.com/

If you did not request this message, please notify [email protected]

--==PHP-alt$mime_boundary
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit 
<html>
<body>
$html_msg
<p>
--<br />
This message was generated automatically as a demonstration on
<a href="http://www.somewebsite.com/"&gt;Me&lt;/a&gt;
</p>
<p>
If you did not request this message, please notify 
<a href="mailto:[email protected]">[email protected]</a>
</p>
</body>
</html>
--==PHP-alt$mime_boundary--
MESSAGE;
A: 

The issue was white space in the heredoc syntax I'm using. It is not represented in the above example.

@qor72 thank you for your input.

hsatterwhite