private void SendResponse(ContactMessage cmessage) { string subject = "PSS - contact form received"; string body = @"Thank you for contacting us! Your information has been sent and we should be in touch with you soon. Thank you, The Premier Senior Solutions Team"; MailSender sender = new MailSender(cmessage.Email); sender.Send(subject, body); }
public ActionResult Contact(ContactMessage cmessage) { if (ModelState.IsValid) { try { this.SendContactForm(cmessage); this.SendResponse(cmessage); ViewBag.ThankYou = "Thank you for contacting us!"; } catch (SmtpException se) { ViewBag.ThankYou = se.Message; } } return View(cmessage); }
// todo: move all filled data to resource or template file private void SendContactForm(ContactMessage cmessage) { cmessage.Subject = string.Format("Client message from {0}", cmessage.Email); MailSender sender = new MailSender("*****@*****.**"); sender.Send(cmessage.Subject, cmessage.Message); }