ics文件未反映在Outlook日历中

I am trying to send an meeting invite from a php code, I am sending the meeting invite through an ics file. However the ics file is coming in as attachment in Gmail but not being reflected in Ms Outlook.

This is the following File Format that I have:

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).
Where: Nowhere

Note: The GMT offset above d
    oes not reflect daylight saving time adjustments.

*~*~*~*~*~*~*~*~*~*

    
sdcsdascsdcs

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">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server ve
    rsion 08.00.0681.000">
<TITLE></TITLE>
</HEAD>
<BODY>
<!-- Converted f
    rom text/rtf format -->

<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 &amp\; Canada).</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us
    "><FONT FACE="Calibri">Where: Nowhere</FONT></SPAN></P>

<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>

<P DIR=LTR><S
    PAN LANG="en-us"><FONT FACE="Calibri">*~*~*~*~*~*~*~*~*~*</FONT></SPAN></P
    >

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">sdcsdascsdcs</FONT
    ></SPAN><SPAN LANG="en-us"></SPAN></P>

</BODY>
</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

I am not able to figure out where is the problem. This is my Php code

<?php
$domain = 'xyz.com';

//Create Email Headers
$mime_boundary = "----Meeting Booking----".MD5(TIME());

$headers = "From: ".$from_name." <".$from_address.">
";
$headers .= "Reply-To: ".$from_name." <".$from_address.">
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"
";
$headers .= "Content-class: urn:content-classes:calendarmessage
";

//Create Email Body (HTML)
$message = "--$mime_boundary
";
$message .= "Content-Type: text/html; charset=UTF-8
";
$message .= "Content-Transfer-Encoding: 8bit

";
$message .= "<html>
";
$message .= "<body>
";
$message .= '<p>Dear '.$to_name.',</p>';
$message .= '<p>'.$description.'</p>';
$message .= "</body>
";
$message .= "</html>
";
$message .= "--$mime_boundary
";

$ical =
'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).
Where: Nowhere

Note: The GMT offset above d
oes not reflect daylight saving time adjustments.

*~*~*~*~*~*~*~*~*~*


sdcsdascsdcs
'."
".
'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">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server ve
rsion 08.00.0681.000">
<TITLE></TITLE>
</HEAD>
<BODY>
<!-- Converted f
rom text/rtf format -->

<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 &amp\; Canada).</FONT></SPAN></P>

<P DIR=LTR><SPAN LANG="en-us
"><FONT FACE="Calibri">Where: Nowhere</FONT></SPAN></P>

<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>

<P DIR=LTR><S
PAN LANG="en-us"><FONT FACE="Calibri">*~*~*~*~*~*~*~*~*~*</FONT></SPAN></P
>

<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">sdcsdascsdcs</FONT
></SPAN><SPAN LANG="en-us"></SPAN></P>

</BODY>
</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'."
";
$message .= 'Content-Type: text/calendar;name="veer-invite.ics";method=REQUEST
';
$message .= "Content-Transfer-Encoding: 8bit

";
$message .= $ical;

$mailsent = mail($to_address, $subject, $message, $headers);
?>

2个回答



PHPMailer中的这个开放问题。 虽然这不是PHPMailer的问题(这是Outlook的错误),但是在PHPMailer中构建变通方法并不容易 - 你可能最好使用不同的系统来构建你的MIME结构,例如 Zend_MIME 。</ p>
</ div>

展开原文

原文

There's some great investigation of this problem in this open issue in PHPMailer. Though it's not a problem of PHPMailer's making (it's Outlook's fault), there's no easy way to build the workaround in PHPMailer - you may be better off usig a different system to build your MIME structure, such as Zend_MIME.



Outlook要求文本/日历部分必须是唯一的MIME部分。</ p>

HTML正文可以设置为VCALENDAR的一部分。</ p>
</ div>

展开原文

原文

Outlook requires that the text/calendar part must be the one and only MIME part.

HTML body can be set as part of VCALENDAR.

duanjiwang2927
duanjiwang2927 你究竟要解决什么问题? 您的邮件在Outlook中看起来不像会议邀请/更新?
大约 6 年之前 回复
douxi1738
douxi1738 这不是真的。 Outlook期望vcal部分是多部分/替代结构的附加部分,但如果它不是多部分结构的一部分,它也可以工作。
大约 6 年之前 回复
dt3696912
dt3696912 看,我会告诉你..我正在使用上面的PHP代码发送会议邀请,我在GMAIL和WebMail中获得了一个ICS文件,但它没有反映在Outlook中。 也就是说,我没有在Outlook中获得附件。 甚至当我进入Gmail或Webmail时,我也没有收到Outlook上的会议邀请
大约 6 年之前 回复
doumei2023
doumei2023 从哪里下载ICS文件? Outlook不发送ICS文件。 您是否可以访问整个MIME消息?
大约 6 年之前 回复
duanna2026
duanna2026 我做的是我发送了一个来自outlook的邮件邀请,下载了ics文件,阅读了内容,但那里没有MIME部分..
大约 6 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐