总结是,我现在正在实现一个事件确认系统,但找不到 ICalendar 回复的正确格式。因此我想知道是否有一个完整的 REPLY 消息的示例,也许还有一个 PHP 库可以包装所有这些消息?
现在了解详细信息,我们收到外部电子邮件,包括要求回复的活动邀请。以下是 iCal 文件的摘录:
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="'[email protected] /cdn-cgi/l/email-protection'":MAILTO:[email protected] /cdn-cgi/l/email-protection ORGANIZER;CN="Organ Izer":MAILTO:[email protected] /cdn-cgi/l/email-protection
我找不到向主办方发送RSVP的回复标准。这RFC 2447 https://www.rfc-editor.org/rfc/rfc5545#section-3.2.12提到“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:[email protected] /cdn-cgi/l/email-protection
UID:[email protected] /cdn-cgi/l/email-protection
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=CONFIRMED;RSVP=
TRUE;[email protected] /cdn-cgi/l/email-protection;X-NUM-GUESTS=0:mailto:[email protected] /cdn-cgi/l/email-protection
LOCATION:
SEQUENCE:1
END:VEVENT
END:VCALENDAR';
mail('[email protected] /cdn-cgi/l/email-protection', 'Accepted:', "Event accepted", $headers);
Ical 消息或方法本身有什么问题吗?这是事件回复应该发送的方式吗?
以下代码适用于谷歌日历。附件由 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:[email protected] /cdn-cgi/l/email-protection
UID:[email protected] /cdn-cgi/l/email-protection
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;
[email protected] /cdn-cgi/l/email-protection:mailto:[email protected] /cdn-cgi/l/email-protection
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('[email protected] /cdn-cgi/l/email-protection', 'Jean-Charles');
$mail->Body = "HTML BODY";
$mail->AltBody = "Text body";
$mail->Subject = "Email title";
$mail->Sender = "User Name";
$mail->FromName = "[email protected] /cdn-cgi/l/email-protection";
$mail->AddStringAttachment($vcal, 'meeting.ics', "base64", "text/calendar");
$mail->Send();
重要的部分是
- 内容类型:文本/日历
- 方法:回复
- PARTSTAT:已接受|已拒绝
- UID
我不确定是否有必要发回所有冗余信息(描述、摘要、dtend、dtstart)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)