I need to use a company shared account *** Email address is removed for privacy *** to send notifications. But fails all the time. I tried all possible codes with no luck.
So, I had a little suspicious about the account. Then I used my office 365 work account, and it is ok. But I still need to use the shared account.
The error information is as following:
Message = "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [D*******8.na***11.prod.outlook.com]"
Please help!
SmtpClient client = new SmtpClient(host, port);
client.EnableSsl = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
//client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(configuration["smtp:username"], configuration["smtp:password"]);
await client.SendMailAsync(mailMessage);