如何让ics日历邀请自动添加到日历 [英] How to get ics calendar invitation to automatically add to calendar

查看:37
本文介绍了如何让ics日历邀请自动添加到日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用节点包 ical-generator 生成 .ics 日历邀请,并通过 mandrill 在电子邮件中发送附件.

.ics 日历邀请包含特定时间和日期的一项活动的信息.

示例生成文件:

BEGIN:VCALENDAR版本:2.0PRODID:-//sebbo.net//ical-generator//EN方法:请求名称: xxxx 活动X-WR-CALNAME: xxxxx开始:事件UID:5wzd@xxx.com序列:0DTSTAMP:20180318T202459ZDTSTART:20180330T230000Z大通:20180330T230000Z总结:测试地点:测试描述:测试ORGANIZER;CN="info":mailto:info@xxxx.com结束:VEVENTEND:VCALENDAR

现在,用户会收到作为电子邮件附件的日历邀请,如果他们打开附件并单击添加到日历"(在 Outlook 中),则可以将事件添加到他们的日历中.

我需要进行哪些更改,以便邮件客户端自动解析日历邀请并将其添加到用户的日历中(类似功能可在来自诸如 meetup 和 eventbrite 等网站的电子邮件确认中找到).

不确定我是否了解有关电子邮件客户端、日历系统或 .ics 文件如何工作的上下文知识,以了解如何解决此问题的框架

非常感谢任何对资源的建议或指示!谢谢!

解决方案

为了自动添加事件,你需要考虑三点:

  1. 电子邮件标题
  2. iCalendar 方法
  3. 参加者信息VEVENT"日历组件

电子邮件标题

为了让电子邮件客户端正确解析附加的 .ics 文件,您应该将调度方法和 MIME 信息添加到电子邮件标题中.这由 iCalendar 基于消息的互操作性协议 (RFC 2447) 指定.>

因此,您的标题应包含 Content-Type,Content-Transfer-EncodingContent-Disposition 如以下示例中所指定:

Content-Type:文本/日历;字符集=utf-8;方法=请求;名称=invite.ics'内容传输编码:Base64Content-Disposition:附件;文件名=invite.ics

iCalendar 方法

当在 MIME 消息实体中使用时,METHOD"的值是必须与内容类型方法"相同.这只能在 iCalendar 对象中出现一次.此字段的值由 iCalendar 传输独立互操作性协议 (iTIP) 定义(RFC 5546).为了请求会议,该值应为 REQUEST";.

方法:请求

参加者信息VEVENT"日历组件

此属性是特定与会者"的状态.相对于一个事件.它用于调度并由PARTSTAT"定义.ATTENDEE"中的参数每位与会者的财产.

ATTENDEE;PARTSTAT=ACCEPTED;CN="JaneDoe"EMAIL=jdoe@gmail.com:MAILTO:jdoe@gmailcom

以下是最小 .ics 文件的示例:

BEGIN:VCALENDAR版本:2.0CALScale:GREGORIAN方法:请求开始:事件UID:@.comDTSTAMP:20210605T073803ZDTSTART;TZID=美国/瓜亚基尔:20210614T030000DTEND;TZID=美国/瓜亚基尔:20210614T040000总结:我的活动ORGANIZER;CN=Juan Perez":mailto:jperez@organizer.com参加者;PARTSTAT=接受;CN=简Doe"EMAIL=jdoe@gmail.com:MAILTO:jdoe@gmailcomURL;VALUE=URI:https://.com/event/5960492994476830083结束:VEVENTEND:VCALENDAR

有关更多详细信息,请查看我的要点.

I am generating .ics calendar invitation with the node package ical-generator and sending the attachment in an email via mandrill.

The .ics calendar invite contains information for one event at a specific time and date.

example generated file:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//sebbo.net//ical-generator//EN
METHOD:REQUEST
NAME: xxxx Events
X-WR-CALNAME: xxxxx
BEGIN:VEVENT
UID:5wzd@xxx.com
SEQUENCE:0
DTSTAMP:20180318T202459Z
DTSTART:20180330T230000Z
DTEND:20180330T230000Z
SUMMARY:test
LOCATION:test
DESCRIPTION:test
ORGANIZER;CN="info":mailto:info@xxxx.com
END:VEVENT
END:VCALENDAR

Right now, the user receives the calendar invitation as an attachment in the email and is able to add the event to their calendar if they open up the attachment and click on "add to calendar" (in outlook).

What changes do I need to make so that the calendar invite is automatically parsed by the mail client and added to the user's calendar (similar functionality is found in email confirmation from sites like meetup and eventbrite).

Not sure I have the context knowledge around how email clients, calendar systems or .ics files work to have a framework of how to approach this problem

Any suggestions or pointers to resources is greatly appreciated! Thank you!

解决方案

You need to consider three points in order to add events automatically:

  1. Email Header
  2. iCalendar Method
  3. ATTENDEE information the "VEVENT" calendar component

Email Header

In order to get the email client to parse correctly the attached .ics file, you should add the scheduling method and MIME information to the email headers. This is specified by the iCalendar Message-Based Interoperability Protocol (RFC 2447).

For this reason, your header should include Content-Type, Content-Transfer-Encoding and Content-Disposition as specified in the following example:

Content-Type: text/calendar; charset=utf-8; method=REQUEST; name=invite.ics'
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename=invite.ics

iCalendar Method

When used in a MIME message entity, the value of "METHOD" must be the same as the Content-Type "method". This can only appear once within the iCalendar object. The value of this field is defined by the iCalendar Transport-Independent Interoperability Protocol (iTIP) (RFC 5546). In order to request for a meeting, the value should be "REQUEST".

METHOD:REQUEST

ATTENDEE information the "VEVENT" calendar component

This property is the state of a particular "Attendee" relative to an event. It is used for scheduling and is defined by the "PARTSTAT" parameter in the "ATTENDEE" property for each attendee.

ATTENDEE;PARTSTAT=ACCEPTED;CN="Jane 
 Doe";EMAIL=jdoe@gmail.com:MAILTO:jdoe@gmailcom

Here is an example of a minimal .ics file:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
UID:<unique-id>@<site>.com
DTSTAMP:20210605T073803Z
DTSTART;TZID=America/Guayaquil:20210614T030000
DTEND;TZID=America/Guayaquil:20210614T040000
SUMMARY:My Event
ORGANIZER;CN="Juan Perez":mailto:jperez@organizer.com
ATTENDEE;PARTSTAT=ACCEPTED;CN="Jane 
 Doe";EMAIL=jdoe@gmail.com:MAILTO:jdoe@gmailcom
URL;VALUE=URI:https://<site>.com/event/5960492994476830083
END:VEVENT
END:VCALENDAR

For more details, please take a look at my gist.

这篇关于如何让ics日历邀请自动添加到日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆