public ActionResult Contact(string body) { Mail email = new Mail(); email.Subject = "Sugestão"; email.Body = body; SendMailerController a = new SendMailerController(); a.Index(email); return RedirectToAction("Contact"); }
// GET: SendMailer public void Index(Mail email) { MailMessage mail = new MailMessage(); mail.To.Add("*****@*****.**"); mail.From = new MailAddress("*****@*****.**"); mail.Subject = email.Subject; mail.SubjectEncoding = Encoding.UTF8; mail.BodyEncoding = Encoding.UTF8; string Body = email.Body; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = " mail.blogomnes.com"; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "@xXxXx");// Enter seders User name and password //smtp.EnableSsl = true; smtp.Send(mail); }