Questions I am having are
a) Subject of the email that gets delivered always has as "Invitation:" in the beginning of subject along with START DATE and TITLE at the end of the subject.
b) When someone opens the email, before accepting the event, it has SUMMARY where it takes whatever is defined in SUBJECT. Is there a different property for this?
c) The body of the email has HTML characters and when I assign it to the 'description' the same it shows all HTML characters within the email.
d) Does the problem seems to be with "AddAlternateView"?? Is this line causing all of the previous values to get reset or is this line making any changes? I tried with AddCalendar (which is obsolete) but still no success.
Below is the code.
using Aspose.Network;
using Aspose.Network.Mail;
using Aspose.Network.Exchange;
void AsposeTest(string cBody)
{
// cBody is a string that has body of the email that has TR, TD and other HTML characters.
DateTime dt1 = (DateTime) L1["EventDate"];
DateTime dt2 = (DateTime) L1["EndDate"];
string cFLName = L1["Requestor"].ToString();
string cTitle = L1["Title"].ToString();
string cEmail = "test@test.com";
MailMessage msg = new MailMessage();
msg.From = "no-reply@test.com";
msg.To = cEmail;
msg.Subject = "Click ACCEPT to Add to Calendar"; // (" + cTitle + ")";
Appointment app = new Appointment(cTitle, new DateTime((int)dt1.Year, (int)dt1.Month, (int)dt1.Day, (int)dt1.Hour, (int)dt1.Minute, (int)dt1.Second), new DateTime((int)dt2.Year, (int)dt2.Month, (int)dt2.Day, (int)dt2.Hour, (int)dt2.Minute, (int)dt2.Second), msg.From, msg.To);
app.Summary = "Your request has been approved";
app.Description = cBody;
//app.GetAppointmentHtml();
msg.AddAlternateView(app.RequestApointment());
msg.IsBodyHtml = true;
//msg.HtmlBody = cBody;
//msg.Body = cBody;
msg.TextBody = cBody;
SmtpClient smtpClient = new SmtpClient(cSMTPClient);
smtpClient.Send(msg);
}