Using iCalendar/vCalendar to send readable Outlook invitations
If you want to be able to send a calendar invitation that works with Outlook (i.e. can be opened and "accepted" to be added to the user's calendar) but is also readable as an email (or at least a valid calendar invitation) in non-Outlook email clients, there are a couple things you need to know:
The vCalendar record needs to be sent as an attachment with a content-type of "text/calendar; method=REQUEST". If your mail library automatically encodes attachment (as Rails' ActionMail does), you also need to force the encoding type to 8bit and NOT encode the text.
When creating the vCalendar text, you need to add two custom properties:
The first is called METHOD with a value of PUBLISH.
The second is X-MS-OLK-FORCEINSPECTOROPEN with a value of TRUE.
These properties ensure that the time appears on the recipient's calendar.
If you're using Ruby on Rails, the iCalendar plugin works great for this. If you've created a calendar object by doing:
You can then just do the following:
cal.custom_property("METHOD", "PUBLISH")
cal.custom_property("X-MS-OLK-FORCEINSPECTOROPEN", "TRUE")
Then in your mailer, add an attachment like this:
attachments['meeting.ics'] = { :content_type => "text/calendar; method=REQUEST", :content => notification.ical_text, :encoding => '8bit' }
Where notification.ical_text is the output from cal.to_ical.