I have the following method to send email from my asp.net mvc-5 web application as part of a contact us section :-
[HttpPost]
public ActionResult Contact(Contact c)
{
//
if (ModelState.IsValid)
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("****.com");
mail.To.Add(new MailAddress("****.com"));
mail.Subject = "New Feedback Web Site";
mail.IsBodyHtml = true;
System.Text.StringBuilder mailBody = new System.Text.StringBuilder();
mailBody.AppendLine("<b>Dear Sirs, </b><br/><br/>");
mailBody.AppendLine(
"New Feedback hae been submitted , with the following details :- <br/><p>" +
"- Name : <span style='color:#78a22f'>" + c.Name + &qu ...
Go to the complete details ...