Set content-type of mail message for ical attachment to "text/calendar; method=REQUEST"

3 views
Skip to first unread message

Gwyn Howell via StackOverflow

unread,
May 14, 2014, 10:02:38 AM5/14/14
to google-appengin...@googlegroups.com

I am trying to send an iCalendar formatted ics file from App Engine using the App Engine mail API. This works great in GMail. However, Outlook doesn't recognise the file, and I believe the issue is that the content-type is set to "text/calendar" and not "text/calendar; method=REQUEST".

I have tried sending mail with telnet with and without "method=REQUEST" to find that Outlook only actions the ics file if this is included. I have checked the headers sent from App Engine, to find that they do not include method=REQUEST and that is why I believe this is the problem.

I have also seen other people report this issue here and here. There is a java solution to the first link, but having now gone through the App Engine mail api with a fine toothcomb I have so far been unable to set the content-type using Python.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/23656802/set-content-type-of-mail-message-for-ical-attachment-to-text-calendar-method-r

Gwyn Howell via StackOverflow

unread,
May 14, 2014, 10:12:43 AM5/14/14
to google-appengin...@googlegroups.com

I am trying to send an iCalendar formatted ics file from App Engine using the App Engine mail API. This works great in GMail. However, Outlook doesn't recognise the file, and I believe the issue is that the content-type is set to "text/calendar" and not "text/calendar; method=REQUEST".

I have tried sending mail with telnet with and without "method=REQUEST" to find that Outlook only actions the ics file if this is included. I have checked the headers sent from App Engine, to find that they do not include method=REQUEST and that is why I believe this is the problem.

I have also seen other people report this issue here and here. There is a java solution to the first link, but having now gone through the App Engine mail api with a fine toothcomb I have so far been unable to set the content-type using Python.

I have tried overriding the EXTENSION_MIME_MAP dict:

mail.EXTENSION_MIME_MAP['ics'] = 'text/calendar; charset=utf-8; method=REQUEST;'

and setting the header myself:

message.headers = {'content-type': 'text/calendar; charset=utf-8; method=REQUEST;'}

Both were a long shot, and unsurprisingly, neither work.

So how can this be done?

Reply all
Reply to author
Forward
0 new messages