title: Sending an iCalendar invite via Smtp
body: <p>I've been trying to send an iCalendar invite through smtp for a few days now. I'm using the DDay.iCal library to build the iCalendar component of the message and I'm using a more-or-less homegrown smtp server to send the message (unfortunately I'm stuck with this solution for the time being). </p>
  
  <p>I've messed around with a few different ways of doing this and I haven't had any luck. The result is usually that the recipient gets an email with a .ics attachment. In outlook, i can open the attachment and add it to my calendar; gmail will only let me download the attachment. It doesn't recognize it as a calendar invite.</p>
  
  <p>Below is an example of one of the scenarios I've tried. Can someone tell me what's wrong with it or what needs to be done to construct a proper calendar invite message?</p>
  
  <p>Thanks!</p>
  
  <pre><code>Delivered-To: jordan_test@gmail.com
  Received: by 10.68.224.234 with SMTP id rf10csp257513pbc;
      Mon, 27 Aug 2012 09:16:44 -0700 (PDT)
  Received: by 10.50.85.228 with SMTP id k4mr10905189igz.22.1346084204116;
      Mon, 27 Aug 2012 09:16:44 -0700 (PDT)
  Return-Path: &lt;283877=jordan_test=gmail.com@smtp.mycompany.com&gt;
  Received: from smtp.mycompany.com ([214.16.251.150])
      by mx.google.com with SMTP id cw2si32587704icc.106.2012.08.27.09.16.43;
      Mon, 27 Aug 2012 09:16:44 -0700 (PDT)
  Received-SPF: neutral (google.com: 214.16.251.150 is neither permitted nor denied by domain of 283877=jordan_test=gmail.com@smtp.mycompany.com) client-ip=215.16.251.150;
  Authentication-Results: mx.google.com; spf=neutral (google.com: 215.16.251.150 is neither permitted nor denied by domain of 283877=jordan_test=gmail.com@smtp.mycompany.com) smtp.mail=283877=jordan_test=gmail.com@smtp.mycompany.com
  Date: Mon, 27 Aug 2012 16:16:43 GMT
  X-Mailer: BlahCommunicationsServices 1.0.0, by BLAH Inc.
  Subject: =?UTF-8?B?SGV5ISB0aGlzIGlzIGZvciB5b3Uu?=
  From: &lt;ical@return.mycompany.com&gt;
  To: &lt;jordan_test@gmail.com&gt;
  Reply-To: &lt;ical@return.mycompany.com&gt;
  MIME-Version: 1.0
  X-Priority: 3 (Normal)
  Content-Type: multipart/alternative;boundary="__=_Part_Boundary_1687780707_370337274"
  Message-Id: &lt;283877@smtp.mycompany.com&gt;
  References: &lt;283877@smtp.mycompany.com&gt;
  
  
  
  
  
  --__=_Part_Boundary_1687780707_370337274
  Content-Transfer-Encoding: 7bit
  Content-Type: text/plain
  
  test test test
  
  
  --__=_Part_Boundary_1687780707_370337274
  Content-Transfer-Encoding: 7bit
  Content-Type: text/calendar;method=REQUEST;charset=utf-8
  
  BEGIN:VCALENDAR
  VERSION:2.0
  METHOD:PUBLISH
  PRODID:-//ddaysoftware.com//NONSGML DDay.iCal 1.0//EN
  BEGIN:VEVENT
  ATTENDEE;CN=Jordan;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CUTYPE=INDIVIDUAL;RSVP=TRUE:MAILTO:jordan@mycompany.com
  ATTENDEE;CN=Jordan;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;CUTYPE=INDIVIDUAL;RSVP=TRUE:MAILTO:jordan_test@gmail.com
  DESCRIPTION:test test test
  DTEND:20120828T130000
  DTSTAMP:20120827T121642
  DTSTART:20120828T120000
  ORGANIZER:MAILTO:ical@return.mycompany.com
  SEQUENCE:0
  SUMMARY:Hey! this is for you.
  UID:234434
  END:VEVENT
  BEGIN:VTIMEZONE
  END:VTIMEZONE
  END:VCALENDAR
  
  
  
  --__=_Part_Boundary_1687780707_370337274--
  </code></pre>