我正在通过 php 发送会议邀请。我的代码确实发送了会议邀请(最终用户可以看到会议邀请)但是我无法设置 html 描述。
我怀疑问题可能是因为我使用字符串变量将参数传递给X-ALT-DESC
. 在邀请中,我通过DESCRIPTION
标签设置的纯文本可见,但 HTML 文本不可见。如果 Outlook 2007 收到邀请,他应该会看到 HTML 文本,对吗?
这是代码:
$aHeaders = array();
$aHeaders[] = 'MIME-Version: 1.0';
$aHeaders[] = 'Content-Type: text/calendar; method=REQUEST';
$aHeaders[] = 'Content-Class: urn:content-classes:calendarmessage';
$aHeaders[] = 'From: abc@xyz.com';
$aHeaders[] = 'Reply-To: abc@xyz.com';
$sHeaders = implode("\r\n", $aHeaders);
$sBody .= "BEGIN:VCALENDAR\r\n";
$sBody .= "PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\r\n";
$sBody .= "VERSION:2.0\r\n";
$sBody .= "METHOD:REQUEST\r\n";
$sBody .= "X-MS-OLK-FORCEINSPECTOROPEN:TRUE\r\n";
$sBody .= "BEGIN:VEVENT\r\n";
$sBody .= "ATTENDEE:mailto:" . $sTo . "\r\n";
$sBody .= "ORGANIZER;CN=ABC:mailto:ABC@XYZ.com\r\n";
$sBody .= "DTSTAMP:'.date('Ymd').'T'.date('His').'Z''\r\n";
$sBody .= "DTSTART:" . $sConfstart . "\r\n";
$sBody .= "DTEND:" . $sConfend . "\r\n";
$sBody .= "LOCATION:Conference Call\r\n";
$sBody .= "TRANSP:OPAQUE\r\n";
$sBody .= "SEQUENCE:0\r\n";
$sBody .= "UID:'. md5(uniqid(mt_rand(), true)) .'\r\n";
$sBody .= "SUMMARY:" . $sSubject . "\r\n";
$sBody .= "PRIORITY:5\r\n";
$sBody .= "CLASS:PUBLIC\r\n";
$sBody .= "DESCRIPTION:this is plain desc"\r\n";
$sBody .= "X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"><HTML><BODY>html goes here</BODY></HTML>\r\n";
$sBody .= "END:VEVENT\r\n";
$sBody .= "END:VCALENDAR\r\n";
----编辑这里是生成的 iCalendar 字符串
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
ATTENDEE;CN="Test_DM@xyz.com, test1@xyz.com";RSVP=TRUE:mail
to:Test_DM@xyz.com\, test1@xyz.com
CLASS:PUBLIC
CREATED:20140222T144724Z
DESCRIPTION:this is plain desc
DTEND:20140223T140000Z
DTSTAMP:20140222T144640Z
DTSTART:20140223T130000Z
LAST-MODIFIED:20140222T144724Z
LOCATION:Conference Call
ORGANIZER;CN="test_org":mailto:test_org@xyz.com
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:
TRANSP:OPAQUE
UID:20140222T144640Z
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
N">\n<HTML>\n<HEAD>\n<META NAME="Generator" CONTENT="MS Exchange Server ve
rsion 08.00.0681.000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f
rom text/plain format -->\n\n<P><FONT SIZE=2><\;!DOCTYPE HTML PUBLIC &qu
ot\;-//W3C//DTD HTML 3.2//EN"\;>\;<\;HTML>\;<\;BODY>\;html g
oes here<\;/BODY>\;<\;/HTML>\;</FONT>\n</P>\n\n</BODY>\n</HTML>
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR