【问题标题】:ICS email attachment in PHPPHP 中的 ICS 电子邮件附件
【发布时间】:2014-03-18 10:01:07
【问题描述】:

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

【问题讨论】:

标签: php icalendar gcal


【解决方案1】:

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

$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);

【讨论】:

    【解决方案2】:

    您缺少与您要向其发送邀请的用户对应的 ATTENDEE 属性。见Outlook fails to recognize an ics message

    【讨论】:

      猜你喜欢
      • 2021-07-10
      • 1970-01-01
      • 1970-01-01
      • 2011-11-26
      • 2012-08-23
      • 1970-01-01
      • 2012-04-13
      • 2012-11-19
      • 1970-01-01
      相关资源
      最近更新 更多