Send e-mail without appearing in the sent box

1

I do not want these sent items to appear in the real estate email.

            string emailOrigem = imobiliaria.Email;
            string password = imobiliaria.Senha;
            string html = getBody(dados); //aqui serve pra formata o html

            if (!string.IsNullOrEmpty(html))
            {
                MailMessage msg = new MailMessage();
                msg.Subject = dados.Assunto;
                msg.From = new MailAddress(emailOrigem);

                msg.IsBodyHtml = true;
                msg.Body = html;

                if (dados.Modelo.Contains("indicar"))
                {
                    EmailTemplate plate = (EmailTemplate)dados;
                    bool temEmail = !string.IsNullOrEmpty((dados as EmailTemplate).EmailIndicado);
                    if (temEmail)
                    {
                        msg.To.Add(plate.EmailIndicado);
                    }
                }
                else
                {
                    msg.To.Add(new MailAddress(Email da imobiliaria aq));
                }

                SmtpClient smtp = new SmtpClient();
                //smtp.Host = "smtp.gmail.com";
                smtp.Host = "smtp-mail.outlook.com";
                smtp.Port = 587;
                smtp.UseDefaultCredentials = false;
                smtp.EnableSsl = true;
                NetworkCredential nc = new NetworkCredential(emailOrigem, password);
                smtp.Credentials = nc;
                smtp.Send(msg);
    
asked by anonymous 27.09.2016 / 03:19

1 answer

2

The technology being used is to connect to an SMTP server and send the message. Nothing more than this. There is no way to control how the provider will handle the messages.

In the case of Google I know you have an API to do this. But it's something completely different. And if it is to use it you should probably do the whole process for it rather than the SMTP server.

API command example to send the message to the trash .

    
27.09.2016 / 03:49