5

Invitations generated by my ASP.net application, sent as email with .ics attachment to Outlook 2010, are not being processed by the sniffer. As such, they are not appearing as tentative in the calendar, and are not available in the preview pane. The .ics attachment appears to be valid and can be opened in outlook by double clicking. The same invitations sent to Gmail are processed no worries. I have ruled out a number of accepted solutions to the same problem...

  • Outlook is correctly configured, and processes Gmail invitations no problem
  • The message is sent as Content-Type: multipart/mixed, with the attachment as text/calendar.
  • DTEND follows DTSTART !
  • The invitation includes an organizer and an attendee.

The most obvious difference between my invitations and Gmails' is the absence of a DKIM signature, but others have succeeded without this. More generally, has anyone found any microsoft documentation about the operation, logging or troubleshooting of the sniffer?

This is my .ics attachment.

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTART:20140617T083644Z
DTEND:20140617T093644Z
DTSTAMP:20140617T083647Z
ORGANIZER;CN=sby@dimo-gestion.fr:mailto:sby@dimo-gestion.fr
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
 FALSE;CN=bbsimonbb@gmail.com;X-NUM-GUESTS=0:mailto:bbsimonbb@gmail.com
CREATED:20140617T083647Z
DESCRIPTION:Description of flying to Sligo
LAST-MODIFIED:20140617T083647Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Fly to Sligo
TRANSP:OPAQUE
UID:20140617T083647Z
END:VEVENT
END:VCALENDAR

The property X-MS-OLK-FORCEINSPECTOROPEN, specified here, hasn't helped.

My file passes the three iCalendar validators mentionned in this question

My god the internet is clogging up with folk who can't get their invitations into Outlook. Here, here, and here.

The consensus seems to be that you need to add "; method=REQUEST" after the content type in the header of the calendar MIME part. Trouble is, the .net System.Net.Mail library doesn't seem to offer low level access to set this line. The hunt continues.

Community
  • 1
  • 1
bbsimonbb
  • 27,056
  • 15
  • 80
  • 110

2 Answers2

6

Ok I've cracked it. The solution that's worked for me is the combination of the two suggestions here. The text/calendar part must be the only part of the message, and method=REQUEST must be present in the Content-Type header.

To achieve this in .net, you can use AlternateViews as follows...

MailMessage msg = new MailMessage();
msg.From = new MailAddress("gonzo@work");
msg.To.Add("gonzo@home");

System.Net.Mime.ContentType mimeType = new System.Net.Mime.ContentType("text/calendar; method=REQUEST");
AlternateView icalView = AlternateView.CreateAlternateViewFromString(icalendarString, mimeType);
icalView.TransferEncoding = TransferEncoding.SevenBit;
msg.AlternateViews.Add(icalView);
client.Send(msg);

The nice bit is that, in the absence of a body, attachments or other alternate views, .net is clever enough to construct a mail with just one part. Using an alternateView remains necessary, because it's the only way to control the Content-type header. This trick could be useful for anyone else who wants to set the Content-Type of a simple single-part mail in .net. The resulting mail, then, looks like this...

MIME-Version: 1.0
From: gonzo@work
To: gonzo@home
Subject: Fly to Sligo
Content-Type: text/calendar; method=REQUEST
Content-Transfer-Encoding: 7bit

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//www.notilus.com//Dimo Gestion Notilus//FR
CALSCALE:GREGORIAN
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VEVENT
DTSTART:20140619T080132Z
DTEND:20140619T090132Z
DTSTAMP:20140619T080132Z
ORGANIZER;CN=gonzo@work:mailto:gonzo@work
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
 FALSE;CN=gonzo@home;X-NUM-GUESTS=0:mailto:gonzo@home
CREATED:20140619T080132Z
DESCRIPTION:Description of flying to Sligo
X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
 N">\n<html>\n<body>\n<table border="1"><tr><td>\n<b>HTML</b> Description o
 f flying to Sligo\n</td></tr><tr><td>\n<ul><li>HTML has certain advantages
 </li></ul>\n</td></tr></table>\n</body>\n</html>
LAST-MODIFIED:20140619T080132Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Fly to Sligo
TRANSP:OPAQUE
UID:20140619T080132Z
END:VEVENT
END:VCALENDAR

A big thank you to gmail, for effortlessly constructing a working example, and for the marvelous "show original" option. As discussed above, google somehow manages to have a much more complicated message processed correctly, but you need to be a google programmer to figure that out.

Community
  • 1
  • 1
bbsimonbb
  • 27,056
  • 15
  • 80
  • 110
  • 1
    Thanks, there's a lot of useless information out there, this is what saved me though. – philw Jun 13 '15 at 17:33
0

This quite likely has to do with your message MIME structure. You may have to put the icalendar stream in a multipart/alternative (see https://www.rfc-editor.org/rfc/rfc6047#section-4.2 ), or worse, a multipart/mixed containing a multipart/alternative to accomodate all clients.

Community
  • 1
  • 1
Arnaud Quillaud
  • 4,420
  • 1
  • 12
  • 8
  • The Gmail invitations that Outlook likes are multipart/mixed. As you suggest, they have the icalendar as an attachment (MIME type application/ics, base64 encoded), and a multipart/alternate. The multipart/alternate has three parts: text/plain, text/html and text/calendar. As such, the calendar information is sent twice - once as an alternate view, and once as a base64 encoded attachement. I've replicated this as closely as possible, without success for the moment. – bbsimonbb Jun 18 '14 at 12:41
  • What does it look like ? Having just one text/calendar bodypart will not be very user friendly for email clients which cant process those. – Arnaud Quillaud Jun 26 '14 at 11:34