更新时间:2022-05-17 07:34:16
确保用户名和密码在行中正确无误:
Make sure the username and password is correct in the line:
smtp.Credentials = new System.Net.NetworkCredential("computersaddict.himanshu@gmail.com", "password");
尝试评论该行:
try commenting the line :
smtp.UseDefaultCredentials = false;
还尝试在构造函数外部设置属性:
Also try setting the properties outside the constructor:
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
按照以下步骤检查解决方案1 。
1) https://accounts.google.com/DisplayUnlockCaptcha [ ^ ] //点击允许访问您的Google帐户
2)你必须为你的谷歌帐户启用从其他时区/ IP登录。
这样做是按照链接 https://g.co/allowaccess [ ^ ]并允许通过单击继续按钮进行访问。
3)转到以下链接的安全设置 https://www.google.com/ settings / security / lesssecureapps [ ^ ]和启用不太安全的应用。这样您就可以从所有应用程序登录。
Hi,
Check the solution 1 after follow this below steps.
1) https://accounts.google.com/DisplayUnlockCaptcha[^] //Click allow access to your Google account
2) You have to enable login from other timezone / ip for your google account.
to do this follow the link https://g.co/allowaccess[^] and allow access by clicking the continue button.
3) go to security settings at the followig link https://www.google.com/settings/security/lesssecureapps[^] and enable less secure apps . So that you will be able to login from all apps.