public JsonResult EnviarCorreo(ContactoViewModel model) { var rm = new ResponseModel(); if (ModelState.IsValid) { try { var _usuario = usuario.Obtener(FrontOfficeAppStart.UsuarioVisualizando()); var mail = new MailMessage(); mail.From = new MailAddress(model.Correo, model.Nombre); mail.To.Add(_usuario.Email); mail.Subject = "Correo desde contacto"; mail.IsBodyHtml = true; mail.Body = model.Mensaje; var SmtpServer = new SmtpClient("smtp.gmail.com"); // or "smtp.gmail.com" SmtpServer.Port = 465; SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network; SmtpServer.UseDefaultCredentials = false; // Agrega tu correo y tu contraseña, hemos usado el servidor de Outlook. SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "polacan_88"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); } catch (Exception e) { rm.SetResponse(false, e.Message); return(Json(rm)); throw; } rm.SetResponse(true); rm.function = "CerrarContacto();"; } return(Json(rm)); }
public ActionResult PDF() => View(usuario.Obtener(FrontOfficeAppStart.UsuarioVisualizando(), true));