Personal I need your help. Every form that is registered in my system it sends in e-mail to some people warning that it was registered, only that I have two environments, one of homologation and one of production. I need when I send an email, it signals the place that was registered
public void NovoEventoAdverso(int patientId, int hospitalId, int usuarioId)
{
var cadastroRepository = new CadastroRepository();
var investigadorRepository = new UsuarioRepository();
var randomizacaoRepository = new RandomizacaoRepository();
var paciente = cadastroRepository.GetByPatientId(patientId, hospitalId);
var investigador = investigadorRepository.GetbyId(usuarioId);
var randomizacao = randomizacaoRepository.GetByPatientId(patientId, hospitalId);
MailMessage objEmail = FactoryMailMessage();
objEmail.To.Add("Nome Teste <[email protected]>");
objEmail.Subject = $"Novo Evento Adverso - {paciente.inpac}";
var conteudo = "Novo Evento Adverso cadastrado:<br />";
conteudo += $"Iniciais do Paciente: {paciente.inpac}<br />";
conteudo += $"Nome do Investigador: {investigador.Nome}<br />";
conteudo += $"Data da Randomização: {randomizacao.RandomizacaoData.Value.ToString("dd/MM/yyyy")}<br />";
conteudo += $"Data do Preenchimento: {DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}";
objEmail.Body = conteudo;
EnviarEmail(objEmail);
}
private static void EnviarEmail(MailMessage objEmail)
{
var objSmtp = new SmtpClient
{
Host = "smtp.mandrillapp.com",
EnableSsl = true,
Port = 587
};
const string user = "####@#####.com.br";
const string senha = "######";
objSmtp.Credentials = new NetworkCredential(user, senha);
objSmtp.Send(objEmail);
}