Hi,
I need to send the mail in HTML Format. I googled lot but i could not able to get the expected result as html format. Can anyone help what i am missing in this following code to get the html format mail.
C# Code :-
--------
MailAddress sender = new MailAddress(ConfigurationManager.AppSettings["smtpUser"]);
string MailId = Convert.ToString(Session["EmailID"]);
SmtpClient smtp = new SmtpClient()
{
Host = ConfigurationManager.AppSettings["smtpServer"],
Port = Convert.ToInt32(ConfigurationManager.AppSettings["smtpPort"]),
UseDefaultCredentials = false,
EnableSsl = true,
Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["smtpUser"], ConfigurationManager.AppSettings["smtpPass"]),
DeliveryMethod = SmtpDeliveryMethod.Network
};
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
string text = "<table><tr><td>EmpId</td><td>Emp name</td><td>age</td></tr><tr><td>value</td><td>value</td><td>value</td></tr></table>";
msg.From = sender;
msg.To.Add(MailId);
msg.Body = text;
msg.IsBodyHtml = true;
smtp.Send(mail.From, mail.To, mail.Subject, msg.Body);