2
我为()发送电子邮件与PHP邮件作为HTML以下PHP代码:PHP mail();发送电子邮件作为纯文本和HTML一个
<?php
$to = "[email protected]";
$subject = "This is the subject";
$headers = "From: Me<[email protected]>\r\n";
$headers .= "Return-Path: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers .= "X-Priority: 1\r\n";
$message = "This is my <b>message</b>!";
mail($to,$subject,$message,$headers);
?>
但我要支持纯文本和HTML。 HTML用于粗体字体和纯文本等内容,用于在非HTML支持电子邮件客户端中显示This is my message!
而不是This is my <b>message</b>!
。
我该怎么做?
我读了关于边界。那是我在找什么?但如果是这样,如何使用它?我不明白。
是的,边界是你所需要的部分。 你可以看到如何做你希望在这里做一个完整的例子和说明:http://stackoverflow.com/questions/10267840/sending-an-email-with-php-plain-text-and -html。 –
@BenShoval我已经找到了这个,但我不明白。 – David
@David:你不明白什么? – Reeno