Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: How to create a text/calendar email?! Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TriGemini
Newbie
Newbie


Joined: 19 December 2007
Location: Denmark
Online Status: Offline
Posts: 1
Posted: 13 April 2009 at 8:12am | IP Logged Quote TriGemini

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 View TriGemini's Profile Search for other posts by TriGemini
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 13 April 2009 at 8:18am | IP Logged Quote Andrew

This tutorial should be helpful to you.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide