当我添加“方法:请求"时,到iCalendar,Gmail停止识别为事件 [英] When I add "METHOD: REQUEST" to iCalendar, Gmail stops recognizing as event

查看:43
本文介绍了当我添加“方法:请求"时,到iCalendar,Gmail停止识别为事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iCalendar为Gmail用户安排活动.但是,如果事件发生更改,我希望能够发送更新.我读到我必须使用 METHOD:REQUEST 才能进行更新

I'm using iCalendar to schedule events for Gmail users. However, I want to be able to send updates, if/when the event changes. I read that I must use METHOD:REQUEST in order to allow updates.

但是,当我将METHOD:REQUEST添加到我的ics文件中时,Gmail停止将其识别为日历邀请.

However, when I add the METHOD:REQUEST to my ics file, Gmail stops recognizing it as a calendar invite.

这是工作示例没有"METHOD:REQUEST"

Here is the working example WITHOUT "METHOD:REQUEST"

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Cratic//Cratic Huddle//EN
NAME:Cratic Huddle
X-WR-CALNAME:Cratic Huddle
TIMEZONE-ID:Europe/Berlin
X-WR-TIMEZONE:Europe/Berlin
BEGIN:VEVENT
UID:60212c8395841f2cd057864f@cratic.ai
SEQUENCE:0
DTSTAMP:20210208T130601Z
DTSTART:20210219T133059Z
DTEND:20210219T140059Z
SUMMARY:Cratic Huddle
DESCRIPTION:This is the information
ORGANIZER;CN="Izzi":mailto:firstname.lastname@gmail.com
ATTENDEE;ROLE=REQ-PARTICIPANT:MAILTO:firstname.lastname@gmail.com
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:-PT15M
DESCRIPTION:Cratic Huddle
END:VALARM
BEGIN:VALARM
ACTION:AUDIO
TRIGGER:-PT15M
ATTACH;VALUE=URI:Basso
END:VALARM
URL;VALUE=URI:cratic.ai
END:VEVENT
END:VCALENDAR

上面的方法很完美;Gmail弹出并显示一个按钮,询问我是否要接受.

The above works perfectly; Gmail pops up with a button asking if I want to accept.

这是不起作用的示例, "METHOD:REQUEST"

Here is the NOT working example WITH "METHOD:REQUEST"

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Cratic//Cratic Huddle//EN
METHOD:REQUEST
NAME:Cratic Huddle
X-WR-CALNAME:Cratic Huddle
TIMEZONE-ID:Europe/Berlin
X-WR-TIMEZONE:Europe/Berlin
BEGIN:VEVENT
UID:60212c8395841f2cd057864f@cratic.ai
SEQUENCE:0
DTSTAMP:20210208T125937Z
DTSTART:20210219T133059Z
DTEND:20210219T140059Z
SUMMARY:Cratic Huddle
DESCRIPTION:This is the information
ORGANIZER;CN="Izzi":mailto:firstname.lastname@gmail.com
ATTENDEE;ROLE=REQ-PARTICIPANT:MAILTO:firstname.lastname@gmail.com
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:-PT15M
DESCRIPTION:Cratic Huddle
END:VALARM
BEGIN:VALARM
ACTION:AUDIO
TRIGGER:-PT15M
ATTACH;VALUE=URI:Basso
END:VALARM
URL;VALUE=URI:cratic.ai
END:VEVENT
END:VCALENDAR

这会在Google中生成空白电子邮件,并附加.ics文件.它不会出现在日历或其他任何地方.

This generates a blank email in google, with the .ics file attached. It does not appear in the calendar or anywhere else.

这两个iCalendar文件在其他方面完全相同.但是由于某种原因,添加METHOD:REQUEST会终止ics文件/google的读取能力.

These two iCalendar files are identical in every other way. But for some reason adding the METHOD:REQUEST is killing the ics file / google's ability to read it.

为什么?

推荐答案

好-经过数小时的阅读RFC5546,Stackoverflow和许多其他博客之后,我终于有了答案.

Ok - After many hours of reading RFC5546, Stackoverflow, and many other blogs, I finally have the answers.

范围:

  1. 发送日历邀请到Gmail/Outlook/私人电子邮件(namecheap的电子邮件客户端)
  2. 电子邮件客户端自动识别.ics文件并生成接受"邮件.模板
  3. 事件自动在客户端日历中显示为暂定"
  4. 发送事件修订以自动移动客户端日历事件
  1. Sending calendar invites to Gmail / Outlook / Privateemail (namecheap's email client)
  2. Email clients automatically recognizing .ics files and generating "accept" templates
  3. Events automatically appearing in client calendars as "tentative"
  4. Sending event revisions that automatically move client calendar events

有两项基本原则对完成这项工作至关重要:

There are two fundamental principles that are critical to making this work:

  1. .ics文件的内容必须与Gmail/Outlook社区的.ics文件非常匹配,这包括参数的和顺序参数.

  1. The contents of the .ics file must very closely match the .ics file of the Gmail / Outlook community, this includes the parameters and the order of the parameters.

.ics文件附加到电子邮件传输中的方式很奇怪,但很关键:(a).ics文件必须转换为"base64",并且(b)文件标题必须提供类型:'text/calendar; method = REQUEST; name ='file.ics''

The way the .ics file is attached to the email transmission is odd but critical: (a) the .ics file must be turned into 'base64', and (b) the headers of the file need to give a type: 'text/calendar;method=REQUEST;name="file.ics"'

下面,我将给出每个示例,希望这些示例可以节省其他人的时间.

Below I will give examples of each, which I hope save others time on this process.

.ics内容示例:

let iCal = 

`BEGIN:VCALENDAR
PRODID:-//Cratic//_Scheduler//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:${DTStart}
DTEND:${DTEnd}
DTSTAMP:${DTStamp}
ORGANIZER;CN=name:mailto:name@gmail.com
UID:${event._id}@url.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=name@outlook.com;X-NUM-GUESTS=0:mailto:name@outlook.com
CREATED:${DTStamp}
DESCRIPTION:${event.body}
LAST-MODIFIED:${DTStamp}
LOCATION:${location}
SEQUENCE:${sequence}
STATUS:CONFIRMED
SUMMARY:${event.title}
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR`

请注意::以上订购非常重要!并且您的文本周围必须没有死角,即使在此之前或之后再增加一个空格也会破坏电子邮件客户端.此外,这是一个可重用的动态iCal事件模板,只要我保留该事件的记录即可._id,我可以使用该_id将修订发送给所有客户.

Please note: the above ordering is very important! And you must have no dead spaces around the text, even one extra space before or after will disrupt the email client. Also, this is a reusable dynamic iCal event template, as long as I keep a record of the event._id, I can use that _id to send revisions to all my clients.

将.ics附加到电子邮件客户端:

// convert the invite to be base64 for attachment
const buf = Buffer.from(iCal.toString(), 'utf-8');
const base64Cal = buf.toString('base64');

// build the email
const sendEmail = async () => {
    const res = await client.transmissions.send({
        recipients: [{ address: 'name@outlook.com' }],
        content: {
          from: 'name@sparkmail.com',
          subject: req.body.a.title,
          text: req.body.a.body,
          attachments: [
            {
              name: 'invite.ics',
              type: 'text/calendar;method=REQUEST;name=\"invite.ics\"',
              data: base64Cal,
            },
          ],
        },
        options: { sandbox: false },
    });
}

// send the email
sendEmail();

请注意:附件类型对于Outlook识别事件至关重要.

Please note: The attachment type is critical for Outlook to recognize the event.

尽管我确定还有其他/更好的方法可以与这些服务集成,但是我发现上述步骤使我得以完成自己的范围.

Although I'm sure there are other / better ways to integrate with these services, I found the above steps allowed me to accomplish my scope.

这篇关于当我添加“方法:请求"时,到iCalendar,Gmail停止识别为事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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