09-28-2018, 04:53 PM
(09-28-2018, 10:26 AM)leeparvin Wrote: Still no luck. However, by setting the attachment contenttype = 'text/plain' instead of 'text/calendar' fixed the problem.
But then it won't be identified as an ICS file anymore by automated processors. The "Content-Type" matters.
(09-28-2018, 10:26 AM)leeparvin Wrote: idTextPart.Body.Append('BEGIN:VCALENDAR');
.....
idTextPart.Body.Append('END:VCALENDAR');
Calendar.Append('BEGIN:VCALENDAR');
......
Calendar.Append('END:VCALENDAR');
Calendar.SaveToFile(CalendarFile);
You don't need to duplicate the calendar data like that. I would populate just the Calendar object and then Assign() it to idTextPart.Body. Or get rid of the Calendar object and call idTextPart.Body.SaveToFile().
On the other hand, you don't need a temp file at all if you use TIdAttachmentMemory instead of TIdAttachmentFile.
(09-28-2018, 10:26 AM)leeparvin Wrote: Attachment:=TIdAttachmentFile.Create(MailMessage.MessageParts, CalendarFile);
Attachment.ContentType:='text/plain'; -< THIS WORKED!!!!
//// Attachment.ContentType:='text/calendar'; -< THIS DID NOT WORK!!!
Attachment.FileName := CalendarFile;
You are missing the 'method' attribute again on the ContentType. That attribute is REQUIRED by RFC 6047 Section 2.4.