Using ColdFusion CFMail to send Microsoft Outlook Appointment Request

CFMail , ColdFusion - Author:John Gag at 3:51 PM Add comments

I was asked to find a way to send a Microsoft Outlook Appointment Request email using ColdFusion cfmail tag.  I was very much in luck with ColdFusion 8.  Below is cfmail code I found that produces the outlook meeting request.

<cfmail to="test@test.com" from="youremail@test.com" subject="Test appointment" 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">
TEST TEST TEST
</cfmailpart>
<cfmailpart type="text/calendar">
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MINMEDIR//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:20080317T123000Z
DTEND:20080317T133000Z
LOCATION: Reno
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>

All you need to do is setup a simple input form and call the appropriate variables needed (recipient email, body of email, DTSTART, DTEND etc.).  For more information on how to create a vCalendar file check out the following link http://support.microsoft.com/kb/287625

21 responses to “Using ColdFusion CFMail to send Microsoft Outlook Appointment Request”

  1. Troy Says:
    I have a similar blog entry describing a UDF I wrote for generating an iCalendar file which could then be emailed. http://blog.webdh.com/index.cfm/2008/3/21/Generating-an-iCalendar-ics-file
  2. John Gag Says:
    @Troy - Cool, I will have to check that out
  3. Anthony Says:
    This builds an ICS file OK. Something is fishy though. When other applications send me a message with an ICS attached, my iphone will pop up and tell me there is an appointment. However this method doesnt do that. Anone have a fix for the seemless integration to the iphone? Other apps create ICS files that do this so I suppose it is possible.
  4. Dave Says:
    how does one make the user accept the meeting request ? Im truly baffled by how that part works ? any ideas ?
  5. John Gag Says:
    @Anthony - Sorry I do not know the answer to the iPhone problem. @Dave - I am not really sure what your question is?
  6. Jas Says:
    Very cool!! is there anyway I can adapt to get an accept response from the sender?
  7. John Gag Says:
    @Jas - I have not not tried that. Thats a good question. I would like to know how that goes if you figure it out.
  8. Hamlet Says:
    Nice man! Hey, how can I import a contact list from, let's say: Outlook (not using MS Exchange), Mac Mail, Yahoo!, etc.? thanks, Hamelt
  9. Lauren Says:
    Hey, this works great! Really cool! Any idea how to update or delete a calendar item after it's sent from CF?
  10. John Gag Says:
    @Lauren - My next project is going to deal a lot with Exchange, I will let you know what I find out.
  11. Rudolf Says:
    @Lauren - The way I understand it is, you have to give the item a unique UID. If you post an other item with the same UID then it should be updated. See for more info: http://en.wikipedia.org/wiki/ICalendar Haven't tried it myself, yet.
  12. crazymocker Says:
    i had tried with no luck. i am using cf 9. the email that i received only contain the first part. there no meeting request in the email. any advise?
  13. John Gag Says:
    @crazymocker - What exactly are you getting? Do you mind emailing me a snippet of your code?
  14. crazymocker Says:
    this is my code.. same code as yours with some changes for the variables. i just get the normal email with the "TEST TEST TEST" content only. no meeting request. TEST TEST TEST BEGIN:VCALENDAR PRODID:-//Microsoft Corporation//Outlook 11.0 MINMEDIR//EN VERSION:2.0 METHOD:PUBLISH BEGIN:VEVENT DTSTART:20100121T123000Z DTEND:20100121T133000Z LOCATION: Reno TRANSP:OPAQUE SEQUENCE:0 UID:0 DTSTAMP:20100121T030000Z DESCRIPTION:Descriptive text here.\n SUMMARY:Short summary here PRIORITY:5 X-MICROSOFT-CDO-IMPORTANCE:1 CLASS:PUBLIC BEGIN:VALARM TRIGGER:-PT15M ACTION:DISPLAY DESCRIPTION:Reminder END:VALARM END:VEVENT END:VCALENDAR
  15. crazymocker Says:
    sorry for the messy post. here's the link to my code. http://www.dewarisan.com.my/cfappointment.cfm really appreciate if you could help
  16. John Gag Says:
    @crazymocker - I will take a look in a sec
  17. John Gag Says:
    @crazymocker - I have not done this in a while and when I tried I in CF9 I had the same problem as you. I will have to further investigate but I dont have time at the moment. I will try to post something later if I figure it out when I have more time. Sorry
  18. John Says:
    I was having the same problems as crazymocker, although on CF8 (Developer). My solution was removing white space! Although I had copied the code directly, I like to layout my code with plenty of tabs....but this was the problem. Remove all tabs/spaces at the start of each vCalendar line.
  19. crazymocker Says:
    @John - good to hear that works for you but not for me. do you mind take a look at my coding. the link in the comment no 15. i am quite sure that i don't have that tabs/spaces at the start.
  20. Disposable HeRowe Says:
    John, I am using your code for a reminder notice. First off thanks for the leg work on this! I have this working like a charm if I have it as a regular page that I access with my variables however when I move this into a CFC Function and call it on my main page I get an email instead of the reminder notice. I used the exact same code from the cfm page into my cfc function. Any ideas as to why this happens? I am still working on a solution and will let you know if I figure out why. In the meantime any advice would be greatly appreciated! Thanks again!
  21. OutdoorRuss Says:
    Has anyone successfully done this for Outlook Contacts? Can you use custom fields also?

Leave a Reply

Leave this field empty:



Powered by Mango Blog. Design and Icons by N.Design Studio
grouping