Author |
|
TriGemini Newbie
Joined: 19 December 2007 Location: Denmark
Online Status: Offline Posts: 1
|
Posted: 13 April 2009 at 8:12am | IP Logged
|
|
|
I have calendar data in the vCalendar format present in a seperate file. Now I need to send the meeting invitation so it appears as a meeting invitation in outlook ... but I've so far only managed to create an email with the .ics (vCalendar) file as an attachment (i suppose this is a problem with the content-type of the email which is likely to be either text/html or text/plain ... instead of text/calendar?!
Here is what I've tried so far:
Smtp smtp = new Smtp();
smtp.From.AsString = "blabla@blabla.com";
smtp.To.AsString = "receiver@receiver.com";
smtp.Subject = "Test meeting";
smtp.SmtpServers.Add("my mailserver.com", "myaccountname", "mypassword");
TextBodyPart part = smtp.Message.BodyParts.Add("text/calendar");
part.Headers.Add("Conten t-Type", "text/calendar", true);
part.Headers.Add("Conten t-Disposition", "inline", true);
part.TransferEncoding = MailTransferEncoding.Raw8bit;
smtp.Message.BodyHtmlTex t = null;
smtp.Message.BodyPlainTe xt = null;
smtp.Message.Builder.Htm lToPlainMode = HtmlToPlainAutoConvert.Never;
smtp.Message.Builder.Htm lToPlainOptions = HtmlToPlainConvertOptions.None;
StreamReader rd = new StreamReader(@"c:\test.ics");
string content = rd.ReadToEnd();
part.Text = content;
smtp.Send();
Any help is appreciated!!!
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 13 April 2009 at 8:18am | IP Logged
|
|
|
This tutorial should be helpful to you.
Best regards,
Andrew
|
Back to Top |
|
|