Hello,
You are hard-coding the values. Try changing the code as shown below. I think you must have missed it, because while inserting a record in database you are using correct values.
[HttpPost]
public ActionResult Contact(ContactsModel model)
{
if (ModelState.IsValid)
{
InsertContact(model.Name, model.Phone, model.Email, model.Comments);
MailMessage message = new MailMessage();
message.From = new MailAddress(model.Email);
message.To.Add(new MailAddress("lotusms@outlook.com"));
message.Subject = "This is my subject";
message.Body = model.Comments;
SmtpClient client = new SmtpClient();
client.Send(message);
TempData["notice"] = "Someone will reply as soon as possible.";
return RedirectToAction("Index", "Home");
}
return View();
}
Regards,