SendMailUsingTabularFormate From C#

muralikrishnasurap-12704
Posted by muralikrishnasurap-12704 under C# category on | Points: 40 | Views : 560
SmtpClient _SmtpClient = new SmtpClient("smtp.gmail.com");
MailAddressCollection _MailAddressCollection = new MailAddressCollection();
MailMessage _message = new MailMessage();
_message.From = new MailAddress("muralikrishna.surap@gmail.com");
//Formate Message in Tablular formate
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<html><body>");
sb.Append("<table border="+"1>");
sb.AppendFormat("<tr><td>Name:</td><td>{0}</td></tr>","Murali Krishna");
sb.AppendFormat("<tr><td>Designation:</td><td>{0}</td></tr>", "SSA");
sb.AppendFormat("<tr><td>Passion:</td><td>{0}</td></tr>", "Microsoft Web Technologies");
sb.Append("</table>");
sb.Append("</body></html>");
_message.Body = Convert.ToString(sb);
_message.IsBodyHtml = true;
_message.Subject = "Sending mail from c# Code using HTML Formate";
_message.To.Add("muralikrishna.surap@gmail.com");
_SmtpClient.Port = 587;
_SmtpClient.Credentials = new System.Net.NetworkCredential("muralikrishna.surap@gmail.com", "*****");
_SmtpClient.EnableSsl = true;
_SmtpClient.Send(_message);

Comments or Responses

Login to post response