iCalendar .ics accept/decline on iOS

2019-02-07 18:41发布

I have created a php script that sends out iCalendar event invitations (based on RFC 5545). Everything works ok, but on iPhone (iOS 4.2.1) and iPad (iOS 5.1) I don't get an option to accept/decline the event (which appears as a mime-attachment.ics), only to add it to my calendar. In other mail clients (outlook, thunderbird, gmail) this works as expected.

Does iOS' mail client support sending such responses? If yes, does anyone know what should I specify to make this work?

Here's a sample content of the ics file:

BEGIN:VCALENDAR
PRODID:-//Some organization//some application//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
UID:20120920T150350Z-70@http://localhost/www/
CREATED:20120920T150350Z
DTSTAMP:20120921T080800Z
DTSTART:20120921T080800Z
DTEND:20120922T060800Z
DESCRIPTION:Please attend this sample meeting
SUMMARY:Invitation to attend training
LOCATION:Earth
ATTENDEE;RSVP=TRUE:mailto:periklis@example.com
ORGANIZER;CN=periklis@example.com:mailto:periklis@example.com
LAST-MODIFIED:20120921T080800Z
PRIORITY:5
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR

1条回答
唯我独甜
2楼-- · 2019-02-07 19:31

After carefully reading the RFC, here's what I used and worked:

BEGIN:VCALENDAR
PRODID:-//Some organization//some application//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
UID:20120925T072912Z-140@http://localhost/www/
CREATED:20120925T072912Z
DTSTAMP:20120922T090500Z
DTSTART:20120922T090500Z
DTEND:20120923T090500Z
DESCRIPTION:Please attend this sample meeting
SUMMARY:Invitation to attend training
LOCATION:Earth
ATTENDEE;RSVP=TRUE:mailto:periklis@example.com
ORGANIZER;CN=periklis@example.com:mailto:periklis@example.com
LAST-MODIFIED:20120922T090500Z
PRIORITY:5
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR

It's also worth mentioning that the above lines MUST be separated with \r\n. So I assigned each line to an array member and then imploded the array:

$message[]='BEGIN:VCALENDAR';
$message[]='PRODID:-//Some organization//some application//EN';
[...]
$message[]='END:VCALENDAR';

$message = implode("\r\n", $message);
查看更多
登录 后发表回答