我正在尝试从php代码发送会议邀请,我通过ics文件发送会议邀请。但是,ics文件作为附件在Gmail中出现,但没有反映在Outlook中。
这是我的以下文件格式:
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
ATTENDEE;CN=mail@veershubhranshu.com;RSVP=TRUE:mailto:mail@veershubhranshu.com
ATTENDEE;CN=srivastav.veer@gmail.com;RSVP=TRUE:mailto:srivastav.veer@gmail.com
ATTENDEE;CN=veer@veershubhranshu.com;RSVP=TRUE:mailto:veer@veershubhranshu.com
CLASS:PUBLIC
CREATED:20140626T005704Z
DESCRIPTION:When: Thursday\, June 26\, 2014 10:00 AM-10:30 AM (UTC-08:00) P
acific Time (US & Canada).\nWhere: Nowhere\n\nNote: The GMT offset above d
oes not reflect daylight saving time adjustments.\n\n*~*~*~*~*~*~*~*~*~*\n
\nsdcsdascsdcs\n
DTEND:20140626T173000Z
DTSTAMP:20140626T005704Z
DTSTART:20140626T170000Z
LAST-MODIFIED:20140626T005704Z
LOCATION:Nowhere
ORGANIZER;CN="Veer Shubhranshu Shrivastav":mailto:mail.@veershubhranshu.com
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:Test Meeting
TRANSP:OPAQUE
UID:040000008200E00074C5B7101A82E00800000000E02849DF9E90CF01000000000000000
010000000D1CC646A48A62440A0D2308D1F4960AA
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/rtf format -->\n\n<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calib
ri">When: Thursday\, June 26\, 2014 10:00 AM-10:30 AM (UTC-08:00) Pacific
Time (US &\; Canada).</FONT></SPAN></P>\n\n<P DIR=LTR><SPAN LANG="en-us
"><FONT FACE="Calibri">Where: Nowhere</FONT></SPAN></P>\n\n<P DIR=LTR><SPA
N LANG="en-us"><FONT FACE="Calibri">Note: The GMT offset above does not re
flect daylight saving time adjustments.</FONT></SPAN></P>\n\n<P DIR=LTR><S
PAN LANG="en-us"><FONT FACE="Calibri">*~*~*~*~*~*~*~*~*~*</FONT></SPAN></P
>\n\n<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">sdcsdascsdcs</FONT
></SPAN><SPAN LANG="en-us"></SPAN></P>\n\n</BODY>\n</HTML>
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-DISALLOW-COUNTER:FALSE
X-MS-OLK-ALLOWEXTERNCHECK:TRUE
X-MS-OLK-AUTOSTARTCHECK:FALSE
X-MS-OLK-CONFTYPE:0
X-MS-OLK-SENDER;CN="Veer Shubhranshu Shrivastav":mailto:mail@veershubhranshu.com
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
我无法弄清问题在哪里。这是我的Php代码
<?php
$domain = 'xyz.com';
//Create Email Headers
$mime_boundary = "----Meeting Booking----".MD5(TIME());
$headers = "From: ".$from_name." <".$from_address.">\n";
$headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\n";
//Create Email Body (HTML)
$message = "--$mime_boundary\r\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>Dear '.$to_name.',</p>';
$message .= '<p>'.$description.'</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--$mime_boundary\r\n";
$ical =
'BEGIN:VCALENDAR' . "\r\n" .
'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" .
'VERSION:2.0' . "\r\n" .
'METHOD:REQUEST' . "\r\n" .
'X-MS-OLK-FORCEINSPECTOROPEN:TRUE'."\r\n".
'BEGIN:VEVENT'."\r\n".
'ATTENDEE;CN=mail@veershubhranshu.com;RSVP=TRUE:mailto:mail@veershubhranshu.com'."\r\n".
'ATTENDEE;CN=srivastav.veer@gmail.com;RSVP=TRUE:mailto:srivastav.veer@gmail.com'."\r\n".
'ATTENDEE;CN=veer@veershubhranshu.com;RSVP=TRUE:mailto:veer@veershubhranshu.com'."\r\n".
'CLASS:PUBLIC'."\r\n".
'CREATED:20140626T005704Z'."\r\n".
'DESCRIPTION:When: Thursday\, June 26\, 2014 10:00 AM-10:30 AM (UTC-08:00) P
acific Time (US & Canada).\nWhere: Nowhere\n\nNote: The GMT offset above d
oes not reflect daylight saving time adjustments.\n\n*~*~*~*~*~*~*~*~*~*\n
\nsdcsdascsdcs\n'."\r\n".
'DTEND:20140626T173000Z'."\r\n".
'DTSTAMP:20140626T005704Z'."\r\n".
'DTSTART:20140626T170000Z'."\r\n".
'LAST-MODIFIED:20140626T005704Z'."\r\n".
'LOCATION:Nowhere'."\r\n".
'ORGANIZER;CN="Veer Shubhranshu Shrivastav":mailto:mail.@veershubhranshu.com'."\r\n".
'PRIORITY:5'."\r\n".
'SEQUENCE:0'."\r\n".
'SUMMARY;LANGUAGE=en-us:Test Meeting'."\r\n".
'TRANSP:OPAQUE'."\r\n".
'UID:040000008200E00074C5B7101A82E00800000000E02849DF9E90CF01000000000000000
010000000D1CC646A48A62440A0D2308D1F4960AA'."\r\n".
'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/rtf format -->\n\n<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calib
ri">When: Thursday\, June 26\, 2014 10:00 AM-10:30 AM (UTC-08:00) Pacific
Time (US &\; Canada).</FONT></SPAN></P>\n\n<P DIR=LTR><SPAN LANG="en-us
"><FONT FACE="Calibri">Where: Nowhere</FONT></SPAN></P>\n\n<P DIR=LTR><SPA
N LANG="en-us"><FONT FACE="Calibri">Note: The GMT offset above does not re
flect daylight saving time adjustments.</FONT></SPAN></P>\n\n<P DIR=LTR><S
PAN LANG="en-us"><FONT FACE="Calibri">*~*~*~*~*~*~*~*~*~*</FONT></SPAN></P
>\n\n<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">sdcsdascsdcs</FONT
></SPAN><SPAN LANG="en-us"></SPAN></P>\n\n</BODY>\n</HTML>'."\r\n".
'X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE'."\r\n".
'X-MICROSOFT-CDO-IMPORTANCE:1'."\r\n".
'X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY'."\r\n".
'X-MICROSOFT-DISALLOW-COUNTER:FALSE'."\r\n".
'X-MS-OLK-ALLOWEXTERNCHECK:TRUE'."\r\n".
'X-MS-OLK-AUTOSTARTCHECK:FALSE'."\r\n".
'X-MS-OLK-CONFTYPE:0'."\r\n".
'X-MS-OLK-SENDER;CN="Veer Shubhranshu Shrivastav":mailto:mail@veershubhranshu.com'."\r\n".
'BEGIN:VALARM'."\r\n".
'TRIGGER:-PT15M'."\r\n".
'ACTION:DISPLAY'."\r\n".
'DESCRIPTION:Reminder'."\r\n".
'END:VALARM'."\r\n".
'END:VEVENT'."\r\n".
'END:VCALENDAR'."\r\n";
$message .= 'Content-Type: text/calendar;name="veer-invite.ics";method=REQUEST\n';
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= $ical;
$mailsent = mail($to_address, $subject, $message, $headers);
?>
答案 0 :(得分:1)
this open issue in PHPMailer对此问题进行了一些很好的调查。虽然这不是PHPMailer的问题(它的Outlook的错误),但在PHPMailer中构建变通方法并不容易 - 你可能会更好使用不同的系统来构建您的MIME结构,例如Zend_MIME。
答案 1 :(得分:0)
Outlook要求文本/日历部分必须是唯一的MIME部分。
可以将HTML正文设置为VCALENDAR的一部分。