Inserting a table in email, only displays table syntax eg.

I am trying to insert a table in email but it only shows the syntax on the message body of the email.

Attached is the output; enter image description here

mail.Subject = "Blah Service Alert - " + application + " Upgrade (Day, Month, Year)";
mail.Body = "Dear Customer," + Environment.NewLine + Environment.NewLine +

   "I would like to provide notice that we will be carrying out an Upgrade on the " + application + " on (Day, Month, Year)." + Environment.NewLine + Environment.NewLine +

   "Blah Essential Maintenance Downtime Window 2019" + Environment.NewLine + Environment.NewLine +

   "System: " + application + Environment.NewLine + Environment.NewLine +

   "<table><tr>" +
   "<th> Downtime Start </th>" +
   "<th> Downtime Start </th>" +
   "<th> Downtime End </th>" +
   "<th> Downtime End </th>" +
   "</tr> <tr>" +
   "<td> Date: </td" +
   "<td> Time: </td>" +
   "<td> Date: </td>" +
   "<td> Time: </td>" +
   "</tr></table>" + Environment.NewLine + Environment.NewLine +
728x90

2 Answers Inserting a table in email, only displays table syntax eg.

You need to set MailMessage.IsBodyHtml Property to true, assuming that you're using MailMessage class.

1 months ago

Assuming you are using the Outlook Object Model, set the MailItem.HTMLBody property rather than the plain text MailItem.Body.

1 months ago