title: Sending Calendar Events (Invitations) using iCal4j library (Java - Spring)
body: <p>This question is relating to iCal4j library integration with a Java (Spring) application.</p>
  
  <p><strong>Use case</strong> -
  In my application, when a user creates an event from the UI, the invitees should receive a calendar invitation, which they can add to their personal calendar (Google calendar, Outlook calendar or even Thundarbird calendar) by simply clicking on the event. Also, the event organizer should receive a calendar invitation of the same event.</p>
  
  <p><strong>Concern</strong> - 
  While attendees receive the calendar invitation to the created event in the correct format (Google Calendar, Outlook and Thundarbird) via an email, the organizer receives an empty email with an attachment (invite.ics). Please note that this concern only raises in Gmail mail and Outlook mail clients. In Thunderbird, even the organizer receives a complete event request.
  (Please refer the attached code snippet and images for further clarification).</p>
  
  <p>Please let me know how to resolve this issue or any alternate libraries or solutions I can use to get this done.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>StringBuffer buffer = sb.append( "BEGIN:VCALENDAR\n" +
       "PRODID:-//PROD_NAME//PROD_ORG//EN\n" +
       "VERSION:2.0\n" +
       "X-WR-RELCALID:"+calendarEmail.getxWrRelcalid()+"\n" +
       "METHOD:REQUEST\n" +
       "BEGIN:VEVENT\n" +
       calendarEmail.getAttendeeString() +
       calendarEmail.getOrganizerString() +
       "DTSTART:" + calendarEmail.getDtStart() + "\n" +
       calendarEmail.getRruleString() +
       "DTEND:" + calendarEmail.getDtEnd() + "\n" +
       "LOCATION:" + calendarEmail.getLocation() + "\n" +
       "TRANSP:OPAQUE\n" +
       "SEQUENCE:"+calendarEmail.getSequence()+"\n" +
       "UID:" + calendarEmail.getUid() + "\n" +
       "DTSTAMP:" + calendarEmail.getDtStamp() + "\n" +
       "STATUS:"+calendarEmail.getEventStatusString()+"\n" +
       "CATEGORIES:" + calendarEmail.getCategory() + "\n" +
       "DESCRIPTION:" + calendarEmail.getDescription() + "\n" +
       "SUMMARY:" + calendarEmail.getSummary() + "\n" +
       "PRIORITY:5\n" +
       "CLASS:" + calendarEmail.getPublicity() + "\n" +
       "BEGIN:VALARM\n" +
       "TRIGGER:" + calendarEmail.getAlarmTrigger() + "\n" +
       "ACTION:" + calendarEmail.getAlarmAction() + "\n" +
       "DESCRIPTION:Reminder\n" +
       "END:VALARM\n" +
       "END:VEVENT\n" +
       "END:VCALENDAR" );
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/vD0vG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vD0vG.png" alt="Email received by the organizer who is using the Thunderbird mail client"></a></p>
  
  <p><a href="https://i.stack.imgur.com/7fMCQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7fMCQ.png" alt="Email received by the organizer who is using the Google mail client"></a></p>
  
  <p><a href="https://i.stack.imgur.com/lqkBk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lqkBk.png" alt="Email received by an invitee who is using the Google mail client"></a></p>