C# SMTP fails to authenticate on Outlook.com, port 587. “The server response was: 5.7.1 Client was not authenticated”

别来无恙 提交于 2019-11-29 01:13:52

I know that it sounds weird but AFAI remember you should use the UseDefaultCredentials = false before setting Credentials. change your code to:

client.UseDefaultCredentials = false;    
client.Credentials = new System.Net.NetworkCredential(From, Password);

Also make sure that you use an app password (can be created here) if 2-step authentication has been enabled for your Microsoft account.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!