我正在做一些测试,到目前为止我尝试了两种解决方案:
第一个在 headers 内发送消息(mail() 函数的消息参数为空)[]
$boundary = "nextPart";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: ".$from_name." <".$from.">\r\n";
$headers .= "Content-Type: multipart/alternative; boundary = $boundary\r\n";
//Html
$headers .= "\n--$boundary\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= $html;
//Text
$headers .= "\n--$boundary\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= $text;
第二个是这个:http ://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php#attachment (设置标题并在消息中发送它们)
它们都不能正常工作(第一个根本不工作,第二个在 gmail 中工作,但它不是格式正确的电子邮件,有些客户无法处理)。剖析 php mailer ( http://phpmailer.worxware.com/index.php?pg=phpmailer ) 的代码,我发现它甚至没有尝试发送多部分电子邮件。
所以我想知道是否可以使用 php 邮件功能发送格式正确的多部分电子邮件。
谢谢
ps我知道并使用梨邮件,我只是想了解这个东西。