Can not see in OUTLOOK an email sent via SMTP Client (C#)

Monica Bellucci 1 Reputation point
2021-11-09T08:29:22.723+00:00

I have implemented sending email via smtp client. c#

My code:
message.From = new MailAddress(_smtpSettings.Username);
using (var client = new SmtpClient(_smtpSettings.Host, _smtpSettings.Port))
{
client.UseDefaultCredentials = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
client.Credentials = new NetworkCredential(_smtpSettings.Username, _smtpSettings.Password);
await client.SendMailAsync(message);
}

configs:
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_FROM=gmail email
SMTP_PASSWORD=password

I can not see the emails inside outlook from our production enviroment even in "Spam". (email to gmail, etc works good)
We have the same flow on other enviroments, and all email email sends correctly.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
6,964 questions
{count} votes