public async Task <IActionResult> NotificarPermissaoDoacao() { var result = _app.NotificarPermissaoDoacao(); var email = new SendEmail(); var emailSender = new List <EmailAddress>(); emailSender = result.Select(t => new EmailAddress { Email = t.Email, Name = t.Nome }).ToList(); if (emailSender.Count == 0 || emailSender == null) { return(Redirect("~/Home")); } var html = "<html><head></head><body><h3> Olá, você já pode doar novamente!</h3>" + "<br><p>Entre no nosso sistema e verifique qual unidade está precisando do seu tipo sanguíneo.</p><br>"; var response = await email.EmailSenderMultiple(emailSender, "[Importante] BloodClick", html); if (response == "Accepted") { return(Redirect("~/Home")); } return(Redirect("~/admin/bancosangue/ErrorEnvioEmail")); }
public async Task NotificarPermissaoDoacao() { var result = _doacoes.NotificarPermissaoDoacao(); if (result.Count() <= 0) { return; } var emailSender = new List <EmailAddress>(); emailSender = result.Select(t => new EmailAddress { Email = t.Email, Name = t.Nome }).ToList(); if (emailSender.Count == 0 || emailSender == null) { return; } var html = "<html><head></head><body><h3> Olá, você já pode doar novamente!</h3>" + "<br><p>Entre no nosso sistema e verifique qual unidade está precisando do seu tipo sanguíneo.</p><br>"; var response = ""; try { response = await EmailSenderMultiple(emailSender, "[Importante] BloodClick", html); }catch (Exception ex) { return; } if (response == "Accepted") { return; } return; }