How to send an appointment with ComponentPro.Mail ?

0
Hello, I'm trying to send an email with an appointment and I don't want the mail to have an ".ics" attachment. I want the mail to be like those I send through Outlook Calendar. Is there a way to do something like that ? Thanks for your help.
 
asked 8/7/2020 8:23:30 AM
add a comment

2 Answers

0
After many research, I finally found a solution. The calendar content must be added to the mail as an "AlternateViews". Here is an example : using ComponentPro.Net.Mail; string calendarContent = "BEGIN:VCALENDAR" System.Environment.NewLine "PRODID: -//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN" ... // Create a new instance of the Smtp class. Smtp client = new Smtp(); // Connect to the server. client.Connect("myserver"); // Or you can specify the SMTP port with // client.Connect("myserver", 25); // Login to the server. client.Authenticate("user", "password"); // Create a new mail message. MailMessage msg = new MailMessage(); msg.Subject = "Test Subject"; msg.BodyText = "Content"; msg.From = "from@mydomain.com"; msg.To = "to@somedomain.com"; //Add appointment System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar"); ct.Parameters.Add("method", "REQUEST"); AlternateView avCal = new AlternateView(); avCal.SetContent(calendarContent, "text/calendar"); msg.AlternateViews.Add(avCal); // And send it. client.Send(msg); // Close the connection. client.Disconnect();
 
answered 10/1/2020 1:36:44 PM
add a comment
0
Hello, I've sent a Mail about this, to both support and sales and no one seems to be able to answers, since I didn't get any response. I guessed it was possible since the web site show "Supports for iCalendar and vCard, but do I guess well if I say it's not possible ? I'm surprised to be the only one with this problem. If anyone have an answer, I'd like to hear about it.
 
answered 10/1/2020 9:05:34 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged smtp or ask your own question.