Outlook日历附件无法正常工作

时间:2012-07-09 12:18:29

标签: php outlook attachment icalendar

当Outlook日历附件与电子邮件一起发送时,它不会出现在Outlook日历中。即使在打开附件后,它也不会将自己放在日历上。 它在Gmail中运行良好,但在Microsoft Outlook中出现附件问题。

这里我给出了以下代码:

    $msg_email.="BEGIN:VCALENDAR\n";
    $msg_email.="VERSION:2.0\n";
    $msg_email.="PRODID:-//$id//NONSGML $id//EN\n";
    $msg_email.="METHOD:REQUEST\n"; // requied by Outlook
    $msg_email.="BEGIN:VTIMEZONE\n";
    $msg_email.="TZID:$timezone\n";
    $msg_email.="X-LIC-LOCATION:$timezone\n";
    $msg_email.="BEGIN:DAYLIGHT\n";
    $msg_email.="TZOFFSETFROM:+1000\n";
    $msg_email.="TZOFFSETTO:+1100\n";
    $msg_email.="TZNAME:EST\n";
    $msg_email.="DTSTART:19701025T020000\n";
    $msg_email.="RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\n";
    $msg_email.="END:DAYLIGHT\n";
    $msg_email.="BEGIN:STANDARD\n";
    $msg_email.="TZOFFSETFROM:+1000\n";
    $msg_email.="TZOFFSETTO:+1000\n";
    $msg_email.="TZNAME:EST\n";
    $msg_email.="DTSTART:19700329T020000\n";
    $msg_email.="RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\n";
    $msg_email.="END:STANDARD\n";
    $msg_email.="END:VTIMEZONE\n";      

    $msg_email.="BEGIN:VEVENT\n";
    $msg_email.="UID:".date('Ymd').'T'.date('His')."-".rand()."-".$b_id."\n"; 
    $msg_email.="DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook
    //$msg_email.="DTSTART:".date('Ymd', $starttime).'T'.date('His', $starttime)."\n";
    $msg_email.="DTSTART1:".date("Ymd", $starttime)."T".date("His", $starttime)."\n";
    $msg_email.="DTEND1:".date('Ymd', $endtime).'T'.date('His', $endtime)."\n";
    $msg_email.="SUMMARY:".$mrbs_company." Booking\n";
    $msg_email.="END:VEVENT\n";
    $msg_email.="END:VCALENDAR\n";

    $msg_email = str_replace("DTSTART1","DTSTART;TZID=\"$timezone\"",$msg_email);
    $msg_email = str_replace("DTEND1","DTEND;TZID=\"$timezone\"",$msg_email);
            $ics_msg="--MIME_BOUNDRY\n";
    $ics_msg.="Content-Type: text/Calendar; name=".$myFile."\n";
    $ics_msg.="Content-disposition: attachment; filename=".$myFile."\n";
    $ics_msg.="Content-Transfer-Encoding: base64\n";
    $ics_msg.="\n";

    $ics_msg.=$msg_email."\n\n";

0 个答案:

没有答案