我使用php发送多部分/混合消息(纯文本、html和附件)。然而,虽然它适用于大多数账户,雅虎,Gmail和天空似乎显示空白电子邮件。其他东西似乎都在显示邮件。任何帮助都将不胜感激!
我的标题是

$headers .= "Content-Type: multipart/mixed; boundary=\"mixed-" . $random_hash . "-mixed\"\n";
$headers .= "MIME-Version: 1.0\n";

内容是;
--mixed-7df05b31-mixed

Content-Type: multipart/alternative; boundary="alt-7df05b31-alt"

--alt-7df05b31-alt

Content-Type: text/plain; charset=utf-8

            Hello how are you? I am just checking the mailing function.

            Hopefully this will work!

            Cheers.

--alt-7df05b31-alt

Content-Type: text/html; charset=utf-8

<div style="font-family:Arial, Helvetica, sans-serif; font-size: 10pt;">

<div>


            Hello how are you? I am just <b>checking</b> the mailing function.<br><br>


            Hopefully this will work!<br><br>


            Cheers.</div></div>

--alt-7df05b31-alt--

--mixed-7df05b31-mixed

Content-Type: text/plain; name="abc.txt"
Content-Disposition: attachment; filename="abc.txt"
Content-Transfer-Encoding: base64

SEVMTE8gSlVTVCBURVNUSU5HIC4uLiA=

--mixed-7df05b31-mixed--

最佳答案

不要构建自己的mime消息。使用SwiftmailerPHPMailer为您执行此操作。

10-07 22:50