Free Support Forum -

MessageId property empty after sending an email


i'm using release

i'm trying to send an email and i'm trying to get the MessageId so i can use it in case of meeting cancellation.

the problem is that the MessageId property is never populated. it's always empty.

here's the snippet code base on aspose demo sample

// create instance of SMTPClient

SmtpClient client = new SmtpClient(txtMailServer.Text, txtUserName.Text, txtPassword.Text);

// get the attendees

MailAddressCollection attendees = new MailAddressCollection();


// create instance of MailMessage for sending the invitation

MailMessage msg = new MailMessage();

// set from address

msg.From = "";

// set the attendees

msg.To = attendees;

// create instance of Calendar

Calendar cal = new Calendar(txtLocation.Text, DateTime.Now.AddHours(1), DateTime.Now.AddHours(2),, attendees);

cal.Summary = "Monthly Meeting";

cal.Description = "Please confirm your availability.";


// save the message and icalendar.

cal.Save(msg.MessageId + ".ics");

msg.Save(msg.MessageId + ".eml", MessageFormat.Eml);

// send the message with the meeting request




what i'm missing ? how can i have the MessageId ?

can you please provide a small sample in which we can send an appointment and then we send a cancellation for the same appointment ?

thanks for your help

Fady Sayegh

Hi Fady,

Thank you for inquiry.

Please call MailMessage.AddAlternateView() method instead of AddCalendar(). This would fix your problem.