我有一个问题,只有一些 gmail 打开/识别我的应用程序发送的 .ics 文件。似乎它适用于常规 gmail 帐户,但 google 企业帐户电子邮件不会自动打开邀请或自动将其放在用户的日历上。此外,邀请不会在某些手机上自动打开。
function sendevent($to, $from, $fromname, $subject, $body, $method, $start, $end, $id, $app_date, $location, $status){
$company=Company::find_by_id($_SESSION['compid']);
$tz = $company->timezone();
if(!empty($tz)){$tzid = ";TZID=".$tz;}else{$tzid = ";TZID=America/Chicago";}
$mail = new PHPMailer();
$mail->FromName = $fromname;
$mail->From = $from;
$mail->AddAddress($to);
$mail->Subject = $subject;
$vcal = "BEGIN:VCALENDAR\n";
$vcal .= "PRODID:-//SiteArmorInc//ContractorsCloud.com//EN\n";
$vcal .= "VERSION:2.0\n";
$vcal .= "CALSCALE:GREGORIAN\n";
$vcal .= "METHOD:REQUEST\n";
$vcal .= "BEGIN:VEVENT\n";
$vcal .= "DTSTART".$tzid.":".date("Ymd\THi00", strtotime($start))."\n";
$vcal .= "DTEND".$tzid.":".date("Ymd\THi00", strtotime($end))."\n";
$vcal .= "DTSTAMP".$tzid.":".date("Ymd\THi00", time())."\n";
$vcal .= "ORGANIZER;CN=".$from.":mailto:".$from."\n";
$vcal .= "UID:".$id."\n";
$vcal .= "ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPT;RSVP=TRUE;CN=".$to.";X-NUM-GUESTS=0:mailto:".$to."\n";
$vcal .= "CREATED".$tzid.":".date("Ymd\THi00", strtotime($app_date))."\n";
$vcal .= "DESCRIPTION:".str_replace("\n", "\N",str_replace(",","\,",$body))."\n";
$vcal .= "LOCATION:".str_replace(",","\,",$location)."\n";
$vcal .= "LAST-MODIFIED".$tzid.":".date("Ymd\THi00", time())."\n";
$vcal .= "SEQUENCE:0\n";
$vcal .= "STATUS:CONFIRMED\n";
$vcal .= "SUMMARY:".str_replace(",","\,",$subject)."\n";
$vcal .= "TRANSP:OPAQUE\n";
$vcal .= "END:VEVENT\n";
$vcal .= "END:VCALENDAR\n";
$mail->AddStringAttachment($vcal, "ccloud_invite.ics", "8bit", "text/calendar; charset=utf-8; method=REQUEST");
$mail->Body = $body;
if($mail->Send()){return true;}
}
有任何想法吗?