0

マルチパート/代替電子メール (特にテキスト/カレンダーでエンコードされたアイテム) を送信できるようにしたいと考えています。これにより、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
4

1 に答える 1

0

As a final followup, I got this to work on my own, but having oberron's link: Here would have made it a lot easier. That being said, I ended up undoing all of my work and intentionally "breaking" the iCalendar attachment so that it wouldn't be recognized by outlook. As if Outlook's HTML parsing wasn't bad enough (since it uses the same HTML parser that's built into Microsoft Word), when a "valid" iCalendar meeting attachment is recognized, the parser drops into an incredibly rudimentary mode which I couldn't work around. HTML parsing, in particular, went to shit..and this is apparently the intended functionality (when you are creating an e-mail in outlook and attach an event, all html-editing related buttons/functionality disappear for that message.

In the end, tolerable HTML formatting was worth the user having to click on the iCalendar attachment themselves.

于 2013-02-05T13:35:07.213 に答える