ColdFusion/Outlook email discovery

Generating an Outlook meeting invitation from ColdFusion is a challenge. There are snippets of code here and there, but I finally got a working solution.

<cfmail to=”someone@someplace.com (Name here)” from=”someoneelse@someplace.com (Name)” subject=”Test appointment from ColdFusion” type=”multipart”>
<cfmailparam name=”content-class” value=”urn:content-classes:calendarmessage”>
<cfmailparam name=”Content-Type” value=”text”>
<cfmailparam name=”method” value=”REQUEST”>
<cfmailparam name=”charset” value=”utf-8″>
<cfmailparam name=”Content-Transfer-Encoding” value=”7bit”>
<cfmailpart type=”text”>
[Introductory blurb here]
</cfmailpart>
<cfmailpart type=”text/calendar”>
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:20080317T123000Z
DTEND:20080317T133000Z
LOCATION:Your location
TRANSP:OPAQUE
SEQUENCE:0
UID:0
DTSTAMP:20080303T140000Z
DESCRIPTION:Descriptive text here.\n
SUMMARY:Short summary here
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR
</cfmailpart>
</cfmail>

Note: If you don’t include the cfmailparts, and try to send the whole thing with content-type = text/calendar, you (well at least I did) will get the following error: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar; method=REQUEST

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • LinkedIn
  • Technorati
  • Tumblr
This entry was posted in ColdFusion. Bookmark the permalink.

Comments are closed.