我正在开发一个使用PHP的邮件系统。我非常接近完成,因为它除Outlook之外都运行良好(我目前正在测试Outlook 2010,在Windows 7上)。PHP邮件多部分/混合中断Outlook 2010
电子邮件是multipart/mixed
;它包含一组multipart/alternative
HTML和纯文本替代以及可选的附件。这一切都得到正确发送,如果我在Gmail中检查原始标题,它看起来应该看起来。但是,如果我在Outlook中检查原始标题,它会在multipart/mixed
声明后切断任何内容。我在这里包含了标题。我简化了他们;剥离实际的纯文本,html,电子邮件地址,并简化边界。由Gmail显示我的头,看起来有点像这样:
(... information about receiving by the server ...)
To: "Hidden recipients" <[email protected]>
Subject: Een BCC
From: "My Name"<[email protected]>
Reply-To: [email protected]
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" <[email protected]>
Subject: Een BCC
From: "My Name"<[email protected]>
Reply-To: [email protected]
Date: Sun, 19 Jul 2015 14:16:31 +0000
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="PHP-mixed"
我的问题是,怎么会出现这种情况,如何能我解决了这个问题?为什么Gmail运行良好,而Outlook却没有?
这不是一个现实的例子。但看起来你正在手动组装MIME部分。考虑一下事实证明,像SwiftMailer/PHPMailer,而不是handicrafting很难解决的事情。 – mario
谢谢。我目前正在尝试PHPMailer。看起来很容易实现,即使我在共享服务器主机上。现在我已经发送了一个简单的多部分/替代电子邮件,我发现在outlook中“查看完整的标题”实际上是故意切断标题中的邮件正文!至少它效果更好。当我完成它时,我会填写自己的问题的答案! :-) – Jeroen