Example #1
0
        public ActionResult _Contacto(Correo correo)
        {
            if (ModelState.IsValid)
            {
                MailMessage mail = new MailMessage();
                mail.To.Add("*****@*****.**"); // correo de destino!
                mail.From = new MailAddress(correo.From);
                mail.Subject = correo.Subject;
                string Body = correo.Body;
                mail.Body = Body + ". " + Environment.NewLine + "Mail: " + correo.From;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
                smtp.Port = 587;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = new System.Net.NetworkCredential
                ("*****@*****.**", "webtania");// Sender email, correo solo para enviar.
                smtp.EnableSsl = true;
                smtp.Send(mail);
                return RedirectToAction("Index", "Home");
            }
            else
            {
                return RedirectToAction("Index", "Home");
            }

            //
            //
            //
        }
Example #2
0
 public ActionResult _Contacto()
 {
     Correo correo = new Correo();
     return View(correo);
 }
Example #3
0
 public ActionResult Enviar_Correo(int id)
 {
     Correo correo = new Correo();
     ViewBag.id_reporte = id;
     return View(correo);
 }