我设置了一个脚本来发送多部分电子邮件;纯文本和 html 消息。HTML 消息工作得很好,但是当我使用只处理纯文本的电子邮件客户端时,纯文本消息不会呈现,我得到以下信息:
--
这个消息是我自动生成的
http://www.somewebsite.com/
$html_msg = $message_details;
$plain_text_msg = strip_tags($message_details);
$headers = <<<HEADERS
From: Me <info@somewebsite.com>
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 promotions@mewstavern.com
--==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/">Me</a>
</p>
<p>
If you did not request this message, please notify
<a href="mailto:info@somewebsite.com">info@somewebsite.com</a>
</p>
</body>
</html>
--==PHP-alt$mime_boundary--
MESSAGE;