繁体   English   中英

PHP邮件多部分/混合中断Outlook 2010

[英]PHP mail multipart/mixed cut off Outlook 2010

我正在使用PHP开发邮件系统。 我非常接近完成,因为除了Outlook(我目前正在Windows 7的Outlook 2010中进行测试)之外,所有其他功能都很好。

电子邮件是multipart/mixed 它包含HTML的multipart/alternative集和纯文本替代项以及可选的附件。 一切均已正确发送,如果我检查了Gmail中的原始标头,则看起来应该看起来像。 但是,如果我在Outlook中检查原始标题,则它会在multipart/mixed -declaration之后切断所有内容。 我在这里包括了标题。 我简化了它们; 剥离实际的纯文本,html,电子邮件地址,并简化边界。 Gmail向我显示的标题看起来像这样:

(... information about receiving by the server ...)
To: "Hidden recipients" <noreply@domain.com>
Subject: Een BCC
From: "My Name"<my@email.com>
Reply-To: my@email.com
Date: Sun, 19 Jul 2015 14:16:31 +0000
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="PHP-mixed"

This is a message with multiple parts in MIME format.
--PHP-mixed
Content-Type: multipart/alternative; boundary="PHP-alt"
--PHP-alt
Content-type:text/plain;charset=utf-8
Content-Transfer-Encoding: quoted-printable
... here's the plain text alternative
--PHP-alt
Content-type: text/html;charset=utf-8
Content-Transfer-Encoding: quoted-printable
... here's the html-formatted text
--PHP-alt--
--PHP-mixed--

Outlook向我显示的标题看起来像这样:

(... information about receiving by the server ...)
To: "Hidden recipients" <noreply@domain.com>
Subject: Een BCC
From: "My Name"<my@email.com>
Reply-To: my@email.com
Date: Sun, 19 Jul 2015 14:16:31 +0000
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="PHP-mixed"

我的问题是,这是怎么发生的,我该如何解决? 为什么Gmail不能正常运行,而Outlook却不能正常运行?

Outlook显示了应显示的内容:MIME 标头 它不会显示整个MIME消息。 邮件本身是否可以通过Outlook正确显示?

为了参考人们在类似我的问题上绊脚石,我发布了这个答案。 与通过PHP状态发送邮件有关的许多其他SO问题一样,建议使用其他库。 存在许多库,您将在要实现的这些库之间进行选择。

正如Mario在此问题的评论中所述,强烈建议使用库发送更高级的电子邮件! 对我来说,编写正确的标头一直很麻烦,而且这些库易于使用,与构建自己的“邮件库”相比,最终可能会得到更好的结果。

  • SwiftMailer
  • PHPMailer (我为我的应用程序选择了这个)
  • 可能还有其他..只需向Google查询您需要的内容即可。

我对PHPMailer感到很容易实现。 只需将代码复制到我的目录即可! 我不确定SwiftMailer,但我想它的工作原理相似。

底线:不要固执,请使用库! :-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM