我希望能够发送多部分/替代电子邮件(特别是文本/日历编码项目,以便 Outlook、gmail 等打开他们的菜单以与附加的约会进行交互(允许用户将其添加到他们的自己的个人日历)。电子邮件服务器是一个不同的盒子,显然我是通过匿名 SMTP 发送的。以下是传递给 php 5.3.6 mail() 方法的标题和消息:
From: TestNet
Reply-To: TestNet
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="--Meeting Booking--fec0d81281514f7f839dc4cf0c117f64"
Content-class: urn:content-classes:calendarmessage
--Meeting Booking--fec0d81281514f7f839dc4cf0c117f64
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
Dear Robert Burnham,
Here is my HTML Email / Used for Meeting Description
--Meeting Booking--fec0d81281514f7f839dc4cf0c117f64
Content-Type: text/calendar;name="meeting.ics";method=REQUEST;charset=utf-8
Content-Transfer-Encoding: 8bit
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:test@test.net
DTSTART:20121206T134000Z
DTEND:20121206T144000Z
LOCATION:My Office
TRANSP:OPAQUE
SEQUENCE:0
UID:20121116T092255-9178@mydomain.com
DTSTAMP:20121116T152255Z
DESCRIPTION:Here is a brief description of my meeting
SUMMARY:Meeting Booking
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR
电子邮件发送成功,但是我发现我传入的 $message 被视为原始 HTML(以下内容出现在电子邮件的实际正文中):
--Meeting Booking--b37b5edb86b3e7047ce15b2b348159d7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<html>
<body>
<p>Dear Robert Burnham,</p><p>Here is my HTML Email / Used for Meeting Description</p>
</body>
</html>
--Meeting Booking--b37b5edb86b3e7047ce15b2b348159d7
Content-Type: text/calendar;name="meeting.ics";method=REQUEST;charset=utf-8\nContent-Transfer-Encoding: 8bit\n\nBEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
ORGANIZER:MAILTO:mailer@personalhealthsurvey.net
DTSTART:20121206T134000Z
DTEND:20121206T144000Z
LOCATION:My Office
TRANSP:OPAQUE
SEQUENCE:0
UID:20121116T092814-12916@mydomain.com
DTSTAMP:20121116T152814Z
DESCRIPTION:Here is a brief description of my meeting
SUMMARY:Meeting Booking
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR