我在使用ICS附件到Gmail / Google日历地址时遇到了一些问题。 当我必须编辑事件时,我通过邮件发送更新,其中ICS文件与原始事件的UID相同。但是,GCalendar添加了第二个事件。我怎么能克服这个?
这是第一个ICS文件内容:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130425T090000
DTEND:20130425T100000
DTSTAMP:20130206T101100
ORGANIZER;CN=Test test:mailto:test@test.com
ATTENDEE:test@test.eu
UID:CALEVENT_TS090519840000000005
DESCRIPTION:test
SUMMARY:test
LOCATION:Test
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
这是更新ICS文件内容:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130425T100000
DTEND:20130425T110000
DTSTAMP:20130206T101100
ORGANIZER;CN=Test test:mailto:test@test.com
ATTENDEE:test@test.eu
UID:CALEVENT_TS090519840000000005
DESCRIPTION:test
SUMMARY:test
LOCATION:Test
SEQUENCE:2
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
当我收到更新文件并点击“将此活动添加到日历”时,我会发现两个不同的事件。
这是原始的原始电子邮件:
Delivered-To: test@test.eu
Received: by 10.216.231.19 with SMTP id k19csp190640weq;
Sat, 9 Feb 2013 08:01:11 -0800 (PST)
X-Received: by 10.194.7.136 with SMTP id j8mr15530679wja.38.1360425671327;
Sat, 09 Feb 2013 08:01:11 -0800 (PST)
Return-Path: <test@test.eu>
Received: from mxavas8.aruba.it (mxavas8.aruba.it. [62.149.157.18])
by mx.google.com with SMTP id 45si59706250eeg.83.2013.02.09.08.01.11;
Sat, 09 Feb 2013 08:01:11 -0800 (PST)
Received-SPF: neutral (google.com: 62.149.157.18 is neither permitted nor denied by best guess record for domain of test@test.eu) client-ip=62.149.157.18;
Authentication-Results: mx.google.com;
spf=neutral (google.com: 62.149.157.18 is neither permitted nor denied by best guess record for domain of test@test.eu) smtp.mail=test@test.eu
Received: (qmail 4991 invoked by uid 89); 9 Feb 2013 16:01:10 -0000
Delivered-To: test.eu-test@test.eu
Received: (qmail 4424 invoked by uid 89); 9 Feb 2013 16:01:04 -0000
Received: from unknown (HELO mxcmd03.ad.aruba.it) (10.10.10.67)
by mxavas8.ad.aruba.it with SMTP; 9 Feb 2013 16:01:04 -0000
Received: from smtpdg11.aruba.it ([62.149.158.229])
by mxcmd03.ad.aruba.it with bizsmtp
id yFwi1k01A4xF4Fy01G14N7; Sat, 09 Feb 2013 17:01:04 +0100
Received: from localhost ([79.54.181.227])
by smtpcmd04.ad.aruba.it with bizsmtp
id yG141k0074umbYX01G140P; Sat, 09 Feb 2013 17:01:04 +0100
Date: Sat, 9 Feb 2013 17:01:04 +0100
Return-Path: test@test.eu
To: test@test.eu
From: Event notification <test@test.eu>
Reply-To: Event notification <test@test.eu>
Subject: New Event
Message-ID: <238497c6d05cffae45716486e74a8009@localhost>
X-Priority: 3
X-Mailer: PHPMailer 5.2.2 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="b1_238497c6d05cffae45716486e74a8009"
X-Spam-Rating: mxavas8.ad.aruba.it 1.6.2 0/1000/N
--b1_238497c6d05cffae45716486e74a8009
Content-Type: multipart/alternative;
boundary="b2_238497c6d05cffae45716486e74a8009"
--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
test
DateTimeRoom
02/05/201309.00 - 10.15ROOM1
--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<style type="text/css">
<!--
td{ background-color: #eee; }
-->
</style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; color: #333;">
<p style="text-align:center;"><img src="images/logo2.png" alt="Logo" /></p>
<hr style="border: 1px solid #ccc; width: 80%;" />
<div style=" width: 80%; margin: 10px auto;">
<h4></h4>
<h3>test</h3>
<table style="width: 400px; table-layout: fixed; border: 1px solid #ccc;">
<tr><th>Date</th><th>Time</th><th>Room</th></tr>
<tr><td>02/05/2013</td><td>09.00 - 10.15</td><td>ROOM 1</td></tr>
</table>
</div>
</body>
</html>
--b2_238497c6d05cffae45716486e74a8009--
--b1_238497c6d05cffae45716486e74a8009
Content-Type: text/calendar; name="event.ics"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="event.ics"
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:tsCalendar
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130502T090000
DTEND:20130502T101500
DTSTAMP:20130209T170100
ORGANIZER:mailto:test@test.eu
ATTENDEE:mailto:test@test.eu
UID:CALEVENT_TS090519840000000013
DESCRIPTION:test
SUMMARY:test
LOCATION:ROOM1 (floor: prova)
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
--b1_238497c6d05cffae45716486e74a8009--
以下是ORGANIZER电子邮件的其他测试与发件人电子邮件和ATTENDEE电子邮件相同,与Receiver电子邮件相同。
答案 0 :(得分:6)
请参阅RFC5546 Update an Event
活动将移至其他时间。 “UID”的组合 属性(未更改)和“SEQUENCE”(碰到1)属性 表示更新。
根据你所分享的内容,你可能需要在你的文件中添加一个SEQUENCE属性,并为每次更新增加它。
<强>更新强> 鉴于您添加的ote文件,您缺少组织者和与会者字段,下面的文件是更新工作
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:pyICSParser
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130425T090000
DTEND:20130425T100000
DTSTAMP:20130206T101100
ORGANIZER:mailto:organiser@example.com
ATTENDEE:mailto:attendee@example.com
UID:CALEVENT_TS090519840000000005
DESCRIPTION:test
SUMMARY:test
LOCATION:Test
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
此外,您需要将发件人的电子邮件地址与组织者的电子邮件地址以及与会者的电子邮件地址相匹配,以下内容已通过Google日历验证。
eml_as_string:
Subject: New Event
Message-ID: <238497c6d05cffae45716486e74a8009@localhost>
X-Priority: 3
X-Mailer: PHPMailer 5.2.2 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="b1_238497c6d05cffae45716486e74a8009"
X-Spam-Rating: mxavas8.ad.aruba.it 1.6.2 0/1000/N
--b1_238497c6d05cffae45716486e74a8009
Content-Type: multipart/alternative;
boundary="b2_238497c6d05cffae45716486e74a8009"
--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
test
DateTimeRoom
02/05/201309.00 - 10.15ROOM1
--b2_238497c6d05cffae45716486e74a8009
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<style type="text/css">
<!--
td{ background-color: #eee; }
-->
</style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; color: #333;">
<p style="text-align:center;"><img src="images/logo2.png" alt="Logo" /></p>
<hr style="border: 1px solid #ccc; width: 80%;" />
<div style=" width: 80%; margin: 10px auto;">
<h4></h4>
<h3>test</h3>
<table style="width: 400px; table-layout: fixed; border: 1px solid #ccc;">
<tr><th>Date</th><th>Time</th><th>Room</th></tr>
<tr><td>02/05/2013</td><td>09.00 - 10.15</td><td>ROOM 1</td></tr>
</table>
</div>
</body>
</html>
--b2_238497c6d05cffae45716486e74a8009--
--b1_238497c6d05cffae45716486e74a8009
Content-Type: text/calendar; name="event.ics"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="event.ics"
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:tsCalendar
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20130502T090000
DTEND:20130502T101000
DTSTAMP:20130209T170100
ORGANIZER:mailto:test@test.eu
ATTENDEE:mailto:test@test.eu
UID:CALEVENT_TS090519840000000013
DESCRIPTION:test
SUMMARY:test
LOCATION:ROOM1 (floor: prova)
SEQUENCE:1
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
--b1_238497c6d05cffae45716486e74a8009--
在其上应用了以下脚本:
# -*- coding:utf-8 -*-
import smtplib
def sendInvite(fro,to,emlasstring):
mailServer = smtplib.SMTP('smtp.gmail.com', 587)
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login(login, password)
mailServer.sendmail(fro, to, emlasstring)
mailServer.close()
newUID = "UID:newCALEVENT_TS090519840000000016"
#needed to change UID as once an event was sent its UID is locked and a few attempts were needed to make the script work
eml = open("SO14712929_1.eml",'r').read()
emlhead = "To: "+attendee_eml+CRLF
emlhead += "From:"+fro+CRLF
emlhead += "Reply-To: "+fro+CRLF
eml = emlhead+eml
eml = eml.replace("ORGANIZER:mailto:test@test.eu","ORGANIZER:mailto:"+fro_eml)
eml = eml.replace("ATTENDEE:mailto:test@test.eu","ATTENDEE:mailto:"+attendee_eml)
eml = eml.replace("UID:CALEVENT_TS090519840000000013",newUID)
sendInvite(fro,attendees,eml)
print "invite sent"
eml = open("SO14712929_2.eml",'r').read()
emlhead = "To: "+attendee_eml+CRLF
emlhead += "From:"+fro+CRLF
emlhead += "Reply-To: "+fro+CRLF
eml = emlhead+eml
eml = eml.replace("ORGANIZER:mailto:test@test.eu","ORGANIZER:mailto:"+fro_eml)
eml = eml.replace("ATTENDEE:mailto:test@test.eu","ATTENDEE:mailto:"+attendee_eml)
eml = eml.replace("UID:CALEVENT_TS090519840000000013",newUID)
sendInvite(fro,attendees,eml)
print "updated invite sent"
答案 1 :(得分:5)
提供的一些答案并非(完全)正确。
简而言之,您的ATTENDEE
媒体资源需要更多参数才能确保Google日历将其视为更新:
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
TRUE;CN=Recipient Name;X-NUM-GUESTS=0:mailto:recipient@gmail.com
我有同样的问题并找到答案我:
这些是我的发现:
METHOD
必须为REQUEST
(* 1)sender
不一定与ORGANIZER
相同(旁注:但是,Google日历中无法更新 ORGANIZER
) ORGANIZER
不需要列为ATTENDEE
recipient
必须是ATTENDEE
ATTENDEE
需要其他参数,而不仅仅是:mailto
STATUS
不需要提供。编辑:这是发送邀请到谷歌日历/ chrome / mac的情况,但邀请似乎没有在其他组合中得到适当的预览似乎UID
(实际上这不是必需的,但确保您的历史测试结果不会受到影响......)清理示例:
BEGIN:VCALENDAR
PRODID:-//YourCompany/AppName//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20180331T150000
DTEND:20180331T160000
DTSTAMP:20180331T150000 // make sure to populate this dynamically
ORGANIZER;CN=organizer@gmail.com:mailto:organizer@gmail.com
UID:BESTIDEVER123
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
TRUE;CN=Recipient Name;X-NUM-GUESTS=0:mailto:recipient@gmail.com
CREATED:20180331T150000 // make sure to populate this dynamically
DESCRIPTION:Best event evah
LAST-MODIFIED:20180331T150000 // make sure to populate this dynamically
LOCATION:
SEQUENCE:0 // don't forget to increment this!!
SUMMARY:A Wonderful Event
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
(* 1)唯一我无法弄清楚的问题是如何让METHOD:PUBLISH
可以更新 - 我正在尝试创建一个不应该回复的日历发布应用。如果有人能搞清楚,我将非常感激。 : - )
答案 2 :(得分:0)
尝试使用METHOD:PUBLISH而不是METHOD:REQUEST