Send Table Format Email In C#

This blog will explain how to create an HTML Table in Email body dynamically in C#. 

C# Code 
  1. string textBody = "<table border="+1+" cellpadding="+0+" cellspacing="+0+" width = "+400+"><tr bgcolor='#4da6ff'><td><b>Inventory Item</b></td> <td> <b> Required Qunatity </b> </td></tr>";  
  2.               
  3.                textBody += "</table>";  
  4.                MailMessage mail = new MailMessage();  
  5.                System.Net.Mail.SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");  
  6.   
  7.                mail.From = new MailAddress("from_email Id");  
  8.                mail.To.Add("to_emild id");  
  9.                mail.Subject = "Test Mail";  
  10.                mail.Body = textBody;  
  11.                mail.IsBodyHtml = true;  
  12.                SmtpServer.Port = 587;  
  13.                SmtpServer.Credentials = new System.Net.NetworkCredential("email""Password");  
  14.                SmtpServer.EnableSsl = true;  
  15.   
  16.                SmtpServer.Send(mail);  
Mandatory  
  1. mail.IsBodyHtml = true;   
Without the above mentioned code, there is no way to get table in email body.