public EmailResult SendContactMessage(HomeContactModel model) { To.Add("*****@*****.**"); From = model.EmailAddress; ReplyTo.Add(model.EmailAddress); Subject = "{0} sent a message".FormatWith(model.Name); return Email("Contact", model); }
public ActionResult Contact(HomeContactModel model) { if (ModelState.IsValid && Try(() => _mailer.SendContactMessage(model).DeliverAsync())) { return RedirectToAction("ContactSuccess"); } return RedirectToAction("Contact"); }