我doingsome測試,我試圖兩種解決方案到目前爲止:是否可以發送混合的TXT/HTML郵件與PHP郵件功能?
第一個發送頭內的消息(郵件的消息參數()函數是空的)[]
$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郵件的代碼(http://phpmailer.worxware.com/index.php?pg=phpmailer)我看到它甚至不嘗試發送多部分電子郵件。
所以我想知道是否可以發送正確格式的多部分電子郵件與PHP郵件功能。
謝謝
p.s.我知道並使用梨郵件,我只是想了解這個事情。
也許會突出顯示「P.S.」 - 否則,「使用Swiftmailer」的答案將會出現十二個:)儘管您不想在這裏使用它們,但您可能需要查看這些庫生成的輸出,並檢查郵件的源代碼是否存在差異。 – 2010-09-09 10:13:24
在每個Content-Type之後,您可能只需要第二對「\ r \ n」。也可以使用\ 015 \ 012進行Windows兼容。 – mario 2010-09-09 10:26:16