简体   繁体   English

前景无法识别ics文件

[英]ics file not recognized by outlook

I have some problems. 我有一些问题。 I'm trying to send an ics file, so an outlook user can add the event in his calendar. 我正在尝试发送一个ics文件,因此Outlook用户可以将事件添加到他的日历中。 In some versions, like 2010, it works well (home edition) but on some, (like business) it doesn't recognize it directly. 在某些版本(如2010)中,它(家用版)运行良好,但在某些版本(如企业)中,它不能直接识别它。 You must double-click the content so you can preview it. 您必须双击内容才能预览它。 In that other version, it shows the calendar option immediately as I've clicked the mail. 在其他版本中,当我单击邮件时,它将立即显示日历选项。

What am I doing wrong? 我究竟做错了什么?

Here is the code for the calendar. 这是日历的代码。

$str="BEGIN:VCALENDAR\r\n
PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN\r\n
VERSION:2.0\r\n
METHOD:REQUEST\r\n
X-MS-OLK-FORCEINSPECTOROPEN:TRUE\r\n
BEGIN:VTIMEZONE\r\n
TZID:GTB Standard Time\r\n
BEGIN:STANDARD\r\n
DTSTART:16011028T000000\r\n
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10\r\n
TZOFFSETFROM:+0300\r\n
TZOFFSETTO:+0200\r\n
END:STANDARD\r\n
BEGIN:DAYLIGHT\r\n
DTSTART:16010325T000000\r\n
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3\r\n
TZOFFSETFROM:+0200\r\n
TZOFFSETTO:+0300\r\n
END:DAYLIGHT\r\n
END:VTIMEZONE\r\n
BEGIN:VEVENT\r\n
ATTENDEE;CN=silvian.iosub@gmail.com;RSVP=
 TRUE:mailto:silvian.iosub@gmail.com\r\n
CLASS:PUBLIC\r\n
CREATED:20110803T133418Z\r\n
DTEND:$endtime_ics\r\n
DTSTAMP:20110803T095605Z\r\n
DTSTART:$starttime_ics\r\n
LAST-MODIFIED:20110803T133418Z\r\n
ORGANIZER;CN=\"Silvian Iosub\":mailto:
 silvian.iosub@avira.com\r\n
PRIORITY:5\r\n
SEQUENCE:0\r\n
SUMMARY;LANGUAGE=ro:New Event\r\n
TRANSP:OPAQUE\r\n
UID:".MD5(TIME())."-85d2-69b00dea0ad4\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-AUTOSTARTCHECK:FALSE\r\n
X-MS-OLK-CONFTYPE:0\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";

I am using swift class to send emails; 我正在使用swift课堂发送电子邮件; Here are the settings: 设置如下:

$attachment = Swift_Attachment::newInstance()
                            ->setFilename("Invitatie.ics")
                            ->setContentType('text/calendar;method=REQUEST;charset=UTF-8;')
                            ->setBody($str)
                ->setDisposition("inline,filename=".$confDesc.".ics");
        $message2->attach($attachment);

Be sure you added this header : 确保添加了此标头:

Content-Type: multipart/ alternative ; 内容类型:多部分/ 替代

And then for the ics file part : 然后对于ics文件部分:

Content-Type: text/calendar; charset="utf-8"; name="testcal.ics" method=REQUEST'."\r\n";
Content-Disposition: inline; filename="testcal.ics"'."\r\n";

NB : \\r\\n MUST be between double quotes 注意: \\r\\n必须在双引号之间

is

DTEND:$endtime_ics\r\n

actually outputting the endtime or do you have some syntax missing? 实际输出结束时间还是您缺少一些语法?

also try validating the ics file at http://severinghaus.org/projects/icv/ 也可以尝试通过以下网址验证ics文件: http://severinghaus.org/projects/icv/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM