public ActionResult Solicitar(SoliciteContatoModel obj) { SoliciteContatoRepository rep = new SoliciteContatoRepository(); string emailFrom = System.Configuration.ConfigurationManager.AppSettings[name: "emailGuest"]; string emailTo = System.Configuration.ConfigurationManager.AppSettings[name: "email"]; string passwordEmailFrom = System.Configuration.ConfigurationManager.AppSettings[name: "senhaEmailGuest"]; if (rep.Save(obj: obj)) { TempData["Sucesso"] = "Solicitação Inserida com sucesso!"; if (!string.IsNullOrEmpty(value: emailFrom) && !string.IsNullOrEmpty(value: emailTo) && !string.IsNullOrEmpty(value: passwordEmailFrom)) { StringBuilder sb = new StringBuilder(); sb.Append(value: obj.xNomeEmpresa + " solicitou contato"); sb.AppendLine(); sb.Append(value: "Id solicitação: " + obj.idSolicitacao); HlpEmail email = new HlpEmail(_objSettings: new SettingsEmail { enableSsl = false, host = "smtp.hlp.com.br", nPort = 587 }); email.SendEmail(mailFrom: emailFrom, mailTo: emailTo, xSubject: "Aviso de Solicitação!", xBody: sb.ToString(), xPassword: passwordEmailFrom); } return RedirectToAction("Home", "Home"); } return View(); }
public ActionResult Formulario(CurriculumModel objCurriculum) { TrabalheConoscoRepository rep = new TrabalheConoscoRepository(); string emailFrom = System.Configuration.ConfigurationManager.AppSettings[name: "emailGuest"]; string emailTo = System.Configuration.ConfigurationManager.AppSettings[name: "email"]; string passwordEmailFrom = System.Configuration.ConfigurationManager.AppSettings[name: "senhaEmailGuest"]; if (rep.Save(objCurriculum: objCurriculum)) { TempData["Sucesso"] = "Curriculum cadastrado com sucesso!"; if (!string.IsNullOrEmpty(value: emailFrom) && !string.IsNullOrEmpty(value: emailTo) && !string.IsNullOrEmpty(value: passwordEmailFrom)) { StringBuilder sb = new StringBuilder(); sb.Append(value: objCurriculum.xNome + " enviou um curriculum"); sb.AppendLine(); sb.Append(value: "Id curriculum: " + objCurriculum.idCurriculumVitae); HlpEmail email = new HlpEmail(_objSettings: new SettingsEmail { enableSsl = false, host = "smtp.hlp.com.br", nPort = 587 }); email.SendEmail(mailFrom: emailFrom, mailTo: emailTo, xSubject: "Curriculum recebido!", xBody: sb.ToString(), xPassword: passwordEmailFrom); } return RedirectToAction("Home", "Home"); } return View(); }