public void notificaCadastro(hotiguassuContext db, string pathTemplates) { var idGirls = this.idObjeto ?? 0; var Girl = db.GirlsModels.FirstOrDefault(c => c.idGirl == idGirls); if (Girl != null) { MailMessage mail = new MailMessage(new MailAddress("*****@*****.**", "hotiguassu.com"), new MailAddress(Girl.email)); mail.Subject = "Confirmação de registro."; string strEmail = ModuloGeral.carregaTemplateEmail(pathTemplates + "\\confirmacaoRegistro.txt"); strEmail = strEmail.Replace("@idCliente", "" + Girl.idGirl); mail.IsBodyHtml = true; mail.Body = strEmail; SmtpClient smtp = new SmtpClient(); smtp.Send(mail); } }
public void notificaEmail(hotiguassuContext db, string pathTemplates) { try { bool emailEnviado = true; switch (this.dsObjeto) { case "N": this.notificaCadastro(db, ""); break; } this.dsErro = ""; this.flEnviado = emailEnviado; } catch (Exception ex) { var erro = ex.ToString(); if (erro.Length > 500) this.dsErro = erro.Substring(0, 500); else this.dsErro = erro; } }