【问题标题】:Is there a standard and an implementation for Icalendar event RSVP是否有 Icalendar 事件 RSVP 的标准和实现
【发布时间】:2013-11-01 22:56:50
【问题描述】:

总结是我现在正在实施一个事件确认系统,但找不到 ICalendar 回复的正确格式。因此,我想知道是否有一个完整的回复消息的例子,也许还有一个 PHP 库可以把它包装起来?

现在详细信息,我们收到外部电子邮件,包括要求回复的活动邀请。这是 iCal 文件的摘录:

ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="'user@company.com'":MAILTO:user@company.com ORGANIZER;CN="Organ Izer":MAILTO:organizer@company.com

我找不到将 RSVP 发送给组织者的回复标准。 RFC 2447 提到了“ATTSTAT”和“PARTSTAT”参数。

通过尝试将以下消息邮寄到 Google 日历,事件未更新。

$headers = "Content-Type:text/calendar; Content-Disposition: inline; charset=utf-8;\r\n";
$headers .= "Content-Type: text/plain;charset=\"utf-8\"\r\n";
$headers .= 'BEGIN:VCALENDAR
VERSION:2.0
METHOD:REPLY
BEGIN:VEVENT
ORGANIZER;CN=JCharles:mailto:abcdef@gmail.com
UID:oc7ae7537999onscsivg8km123@google.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=CONFIRMED;RSVP=
 TRUE;CN=jc@company.se;X-NUM-GUESTS=0:mailto:jc@company.se
LOCATION:
SEQUENCE:1
END:VEVENT
END:VCALENDAR';

mail('abcdef@gmail.com', 'Accepted:', "Event accepted", $headers);

Ical 消息或方法本身有什么问题吗?这是应该发送事件回复的方式吗?

【问题讨论】:

    标签: php email notifications icalendar rfc


    【解决方案1】:

    以下代码适用于谷歌日历。附件由 gmail 处理,接受级联到事件。

    $vcal = 'BEGIN:VCALENDAR
    PRODID:-//EXAMPLE.NU//SE
    VERSION:2.0
    CALSCALE:GREGORIAN
    METHOD:REPLY
    BEGIN:VEVENT
    DTSTART:20101215T160000Z
    DTEND:20101215T170000Z
    DTSTAMP:'.date('Ymd\THis\Z').'
    ORGANIZER;CN=Jean-Charles:mailto:example@gmail.com
    UID:u2coh5g3bppo2d2o3t@google.com
    ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;
     CN=user@example.se:mailto:user@example.se
    CREATED:19000101T120000Z
    DESCRIPTION:äåóö
    LAST-MODIFIED:'.date('Ymd\THis\Z').'
    LOCATION:
    SEQUENCE:0
    STATUS:CONFIRMED
    SUMMARY:a new test
    TRANSP:OPAQUE
    END:VEVENT
    END:VCALENDAR
    ';
    
    $vcal = utf8_encode($vcal);
    
    require('lib/phpmailer/class.phpmailer.php');
    $mail = new PHPMailer();
    $mail->AddAddress('example@gmail.com', 'Jean-Charles');
    $mail->Body = "HTML BODY";
    $mail->AltBody = "Text body";
    $mail->Subject = "Email title";
    $mail->Sender = "User Name";
    $mail->FromName = "user@example.se";
    $mail->AddStringAttachment($vcal, 'meeting.ics', "base64", "text/calendar");
    $mail->Send();
    

    重要的是

    • 内容类型:文本/日历
    • 方法:回复
    • PARTSTAT:接受|拒绝
    • UID

    我不确定是否有必要发回所有冗余信息(描述、摘要、dtend、dtstart)

    【讨论】:

      【解决方案2】:

      以下解决方案对我有用:

      $mail->Subject = $name;
      $mail->Body = $description; 
      $mail->AltBody = $body; // ical format
      $mail->Ical = $message; // ical format
      

      此方法不附加ical格式。

      【讨论】:

        猜你喜欢
        • 2014-10-04
        • 2011-01-25
        • 1970-01-01
        • 1970-01-01
        • 2011-09-10
        • 2012-05-26
        • 2015-02-15
        • 2020-08-30
        • 1970-01-01
        相关资源
        最近更新 更多