public static bool SendEmail(ContactFormModel model) { MailMessage msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.To.Add(new MailAddress("*****@*****.**")); msg.Subject = "AVL Zen Contact"; msg.Body = string.Format("{0},{1}\n{2}", model.Name, model.Email, model.Message); msg.Priority = MailPriority.Normal; var client = new SmtpClient("mail.avlzen.com"); client.UseDefaultCredentials = false; //client.EnableSsl = false; client.Credentials = new NetworkCredential("*****@*****.**", "avzinfo14"); //client.DeliveryMethod = SmtpDeliveryMethod.Network; //client.EnableSsl = true; try { client.Send(msg); } catch (Exception exc) { return false; } return true; }
public ActionResult Contact() { //ViewBag.Message = "Your contact page."; var vm = new ContactFormModel(); vm.Init(); return View(vm); }
public ActionResult Contact(ContactFormModel model) { //string Text = "<html> <head> </head>" + //" <body style= \" font-size:12px; font-family: Arial\">" + //Model.Message + //"</body></html>"; SendEmail(model); var vm = new ContactFormModel(); vm.Init(); ModelState.Clear(); return View(vm); }