Hi again Dillon
Do not understand what's happening, it works when I debug the code but not when I run it. I get the error: 5.7.0 Authentication Required.
Best regards
Göran
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Have this c# code and trying to send mail:
MailMessage mail = new MailMessage(fromAddress.Address, toAddress.Address);
SmtpClient client = new SmtpClient();
client.EnableSsl = true;
client.Host = "smtp-mail.outlook.com";
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(fromAddress.Address,
fromPassword);
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls |
SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
mail.Subject = subject;
mail.Body = body;
client.Send(mail);
Get the error message: Client not authenticated to send mail. Error: 535 5.7.139 Authentication unsuccessful, the user credentials were incorrect
What do I have to do?
Hi again Dillon
Do not understand what's happening, it works when I debug the code but not when I run it. I get the error: 5.7.0 Authentication Required.
Best regards
Göran
It looks like you need to conform to what Office 365 wants:
Try changing your server to smtp.office365.com
---------------------------
If this is helpful please accept answer.
Hi again Dillon
I don't have an office365 email, just an outlook email. Get the same error as before, but in debug mode it's working. Don't understand why it's working in debug but not in production.
Best regards
Göran