PHP邮件错误“不支持日历message.ics”iCal

时间:2014-09-18 18:40:33

标签: php phpmailer icalendar

我发送此作为多部分/部分电子邮件的一部分。但是,我在Outlook中遇到错误"不支持日历message.ics"我已经确认我有一个参加者和一个组织者,所以我不知道为什么会这样。

 $ical = 'BEGIN:VCALENDAR' . "\r\n" .
    'PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN' . "\r\n" .
    'VERSION:2.0' . "\r\n" .
    'METHOD:REQUEST' . "\r\n" .
    'BEGIN:VTIMEZONE' . "\r\n" .
    'TZID:Central Time' . "\r\n" .
    'BEGIN:STANDARD' . "\r\n" .
    'DTSTART:20141101T020000' . "\r\n" .
    'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11' . "\r\n" .
    'END:STANDARD' . "\r\n" .
    'BEGIN:DAYLIGHT' . "\r\n" .
    'DTSTART:20090301T020000' . "\r\n" .
    'RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3' . "\r\n" .
    'TZOFFSETFROM:-0500' . "\r\n" .
    'TZOFFSETTO:-0400' . "\r\n" .
    'TZNAME:EDST' . "\r\n" .
    'END:DAYLIGHT' . "\r\n" .
    'END:VTIMEZONE' . "\r\n" .  
    'BEGIN:VEVENT' . "\r\n" .
    'ORGANIZER;CN="'.$rep.'":MAILTO:'.$repemail. "\r\n" .
    'ATTENDEE;CN="'.$to_name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$to_address. "\r\n" .
    'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
    'UID:'.date("Ymd\TGis", strtotime($startTime)).rand()."@".$domain."\r\n" .
    'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
    'DTSTART;TZID="Central Time":'.date("Ymd\THis", strtotime($startTime)). "\r\n" .
    'DTEND;TZID="Central Time":'.date("Ymd\THis", strtotime($endTime)). "\r\n" .
    'TRANSP:OPAQUE'. "\r\n" .
    'SEQUENCE:1'. "\r\n" .
    'DESCRIPTION: '.$description. "\r\n" .
    'SUMMARY:' . $subject . "\r\n" .
    'LOCATION:' . $location . "\r\n" .
    'CLASS:PUBLIC'. "\r\n" .
    'PRIORITY:5'. "\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";

    // Send Appointment .ical file
    $message .= 'Content-Type: text/calendar;name="message.ics";method=REQUEST\n';
     $message .= "Content-Transfer-Encoding: 8bit\n\n";
    $message .= $ical;

1 个答案:

答案 0 :(得分:2)

您正在处理Outlook嗅探器,即在到达时处理邀请的任务。这是非常挑剔的,没有文件。首先在在线验证器中检查您的Icalendar。然后,从Gmail发送邀请到Outlook。使用Gmail"显示原创"检查生成的Icalendar。更改您的应用程序以完全匹配gmail邀请,包括字段顺序,您应该发现Outlook正确处理了您的邀请。