public ActionResult Error() { var model = new ErrorViewModel() { Email = GetLoggedInUser().Email }; return View(model); }
public ActionResult Error(ErrorViewModel model) { if (ModelState.IsValid) { using (MailMessage msg = new MailMessage( ConfigurationManager.AppSettings[ConfigKeys.SendExceptionEmailsFrom], ConfigurationManager.AppSettings[ConfigKeys.SendExceptionEmailsTo])) { msg.Subject = "[CCIS] User Feedback on Unhandled Exception"; msg.Body = "The user with the email address " + model.Email + " sent the following: " + model.Message; using (SmtpClient mailClient = new SmtpClient(ConfigurationManager.AppSettings[ConfigKeys.MailServer])) { mailClient.Send(msg); } } return RedirectToAction("Index", "Home"); } return View(model); }