0

我需要将 .ics 事件文件发送到 Gmail - 不是作为附件,而是可以选择将相应事件作为日历请求添加到日历中。这样用户就可以将事件添加到谷歌日历。有人可以指出我正确的方向吗?

4

2 回答 2

0

我使用了下面的代码,它只是发送一封电子邮件作为附件,我没有看到接受/添加到谷歌日历选项。

$headers .= "MIME-version: 1.0\r\n";
$headers .= "Content-class: urn:content-classes:calendarmessage\r\n";
$headers .= "Content-type: text/calendar; method=REQUEST; charset=UTF-8\r\n";

$messaje = "BEGIN:VCALENDAR\r\n";
$messaje .= "VERSION:2.0\r\n";
$messaje .= "PRODID:PHP\r\n";
$messaje .= "METHOD:REQUEST\r\n";
$messaje .= "BEGIN:VEVENT\r\n";
$messaje .= "DTSTART:20121223T171010Z\r\n";
$messaje .= "DTEND:20121223T191010Z\r\n";
$messaje .= "DESCRIPTION: You have registered for the class\r\n";
$messaje .= "SUMMARY:Technical Training\r\n";
$messaje .= "ORGANIZER; CN=\"Corporate\":mailto:test@gmail.com\r\n";
$messaje .= "Location:" . $location . "\r\n";
$messaje .= "UID:040000008200E00074C5B7101A82E00800000006FC30E6 C39DC004CA782E0C002E01A81\r\n";
$messaje .= "SEQUENCE:0\r\n";
$messaje .= "DTSTAMP:".date('Ymd').'T'.date('His')."\r\n";
$messaje .= "END:VEVENT\r\n";
$messaje .= "END:VCALENDAR\r\n";
$message .= $messaje;
mail($to, $subject, $message, $headers);
于 2014-03-18T10:37:22.517 回答
0

您缺少与您向其发送邀请的用户相对应的 ATTENDEE 属性。请参阅Outlook 无法识别 ics 邮件

于 2014-03-19T10:42:46.343 回答