Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iCal (.ics) file not recognized by IBM (Lotus) Notes

I'm generating ICS files from a PHP application and emailing them as attachments (via SendGrid api).

The ICS file works fine with Gmail web mail, and with an iPhone. However, IBM Notes does not recognize them as meeting invites. Notes shows the attachment but does not see it as an event invite.

Here's my ICS file:

BEGIN:VCALENDAR
PRODID:-//My Company//v1.1//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20160127T140000Z
DTEND:20160127T143000Z
DTSTAMP:20160114T213657Z
ORGANIZER;CN=Demo Two:
 mailto:[email protected]
UID:e93838a737b3f9ae75056968b22281b2
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=CHAIR;RSVP=FALSE
 ;CN=Demo Two:mailto:[email protected]
CREATED:20160114T213657Z
DESCRIPTION:another scheduled
LAST-MODIFIED:20160114T213657Z
LOCATION:See email
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:another scheduled
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

I'm trying to send the same ICS file to multiple recipients, so I don't include an ATTENDEE line for the recipient, only for the CHAIR.

I can't find ANY detailed information about what Notes requires in its ICS files...

Any ideas what's going wrong?

like image 422
Chris Cober Avatar asked Dec 25 '22 10:12

Chris Cober


2 Answers

I have diagnosed part of my problem by comparing the mail body with a Google Mail invite (which does work in Notes). There are a couple obvious problems when attaching an icalendar ics file via SendGrid web api.

The mail needs to include several parts: a body, an inline text/calendar object, and an attached .ics file.

Outlook and Google user the attached file. I think Notes uses the inline data, since it seems to ignore the .ics attachment.

I found this related StackOverflow question: How to add headers in sendgrid?

So I have gone the route of building the message in SwiftMailer, with appropriate message and attachment headers. It seems to be working properly so far, but I'll confirm when I've tested in Notes.

EDIT: I have confirmed that making the icalendar invite inline does work, and that this invite now appears in Notes.

Each section of the mail needs to have its own MIME type. Here's the message body:

Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<p>Hello,</p>
<p>This is a friendly reminder ...

And here's the icalendar invite (note you can't read the iCalendar data because it's base64 encoded:

Content-Type: text/calendar; charset=UTF-8; method=PUBLISH; name=invite.ics
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename=invite.ics

QkVHSU46VkNBTEVOREFSDQpQUk9ESUQ6LS8vU3RyaWRlLlRyYWluaW5nLy92
MS4xLy9FTg0KVkVSU0lPTjoyLjANCkNBTFNDQUxFOkdSRUdPUklBTg0KTUVU...

I got this output by adding the attachment in SwiftMailer like this:

$attachment = Swift_Attachment::newInstance($ical, 'invite.ics', 'text/calendar');
$attachment->setDisposition('inline');
$attachment->setContentType('text/calendar; charset=UTF-8; method=PUBLISH');
$message->attach ( $attachment );

In the above snippet, $ical is a correctly-formatted iCalendar string.

Sorry this has gotten long, but info on how to do this properly is pretty hard to find.

like image 170
Chris Cober Avatar answered Dec 28 '22 11:12

Chris Cober


It can be one of two problems:

First of all, you should have an attendee at least for the user to whom you are sending the invitation.

If that does not work, the MIME structure of your email may not be recognized by Lotus Notes, in which case you probably want to include the whole MIME message in your question.

like image 21
Arnaud Quillaud Avatar answered Dec 28 '22 11:12

Arnaud Quillaud