public ActionResult Contact([Bind(Include = "ID,Name,Email,PhoneNumber,Subject,Message,ViewStatus,DateSent")] ContactMessageModel contactsModel) { if (ModelState.IsValid) { try { contactsModel.ViewStatus = 0; db.ContactMessages.Add(contactsModel); db.SaveChanges(); TempData["SuccessMessage"] = "Thank you for getting in touch!"; //Send email to Gambia Review string to_name = GMailer.GetGambiaReviewName(); string h1_text = contactsModel.Subject; string h2_text = null; string p1_text = contactsModel.Message; string p2_text = null; AppEmailer.SendEmail(contactsModel.Email, contactsModel.Name, GMailer.GetGambiaReviewEmail(), to_name, contactsModel.Subject, h1_text, h2_text, p1_text, p2_text, null, null, null, null, null); return(RedirectToAction("Contact")); } catch (Exception ex) { TempData["ErrorMessage"] = "Failed to send message, please try again. If you continue to get this error, please send an email to [email protected]."; SecurityFunctions.LogError(ex, contactsModel.Email, "Contact", null); } } return(View(contactsModel)); }