Google禁用“较不安全的应用程序”是否有工作?
因此,自从5月31日Google录制了“不太安全应用程序”的选项以来,我一直在使用Java Mail API,并且由于更新,因此我无法再使用Gmail SMTP发送电子邮件。
这是我遇到的错误:
javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials n13-20020a5d400d000000b0020ff7246934sm4970874wrp.95 - gsmtp
我切换到Outlook Mail,它似乎可以正常工作,但是我想知道是否有一种方法可以使用Gmail帐户
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以通过“应用程序密码”尝试身份验证。
在您的Google帐户上:
set 2-Step验证 on
创建16-Character“ App” App password(
如何创建应用程序密码) - >结果应类似于:
16-character“ app password”
而不是Google帐户密码使用16-Character密码< /p>
You could try authentification via "App password".
On your Google account:
set 2-Step Verification ON
create 16-character "App password"(
How to create app password) -> result should be similar to:
16-character "App password"
Instead of Google account password use 16-character password
因此,感谢您的所有重播!我通过这样做解决了这个问题:
我启用了“ Windows机器的应用程序密码”
然后,我只是将密码从电子邮件密码更改为Google生成的密码
,然后将代码更改为以下内容:
}
So thanks for all the replays! i have fixed this issue by doing this:
I have enabled the "App password for windows machines"
Then i simply changed the password from the email password to the google generated one
and changed the code to the following:
}
现在,您无法再使用Googles SMTP服务器使用登录和密码。唯一的选择是使用“ noreferrer”> xoauth2
我以前没有使用过雅加达,但它似乎支持它。您应该查看 oauth2支持
应用程序密码password
选项两个要转到您的Google帐户并生成一个 apps password
运行代码时,请使用生成的密码而不是实际用户密码。这是其中的主要问题,没有告诉Google将继续支持应用程序密码多长时间。
Now that you can no longer use login and password with Googles smtp server the only option really is to use XOauth2
I havent used Jakarta before but it appears to support it. You should look into OAuth2 Support
Apps password
option two is to go to your google account and generate an apps password
When running your code use the password generated instead of the actual users password. The main issue with this being there is no telling how long google will continue to support apps password.
注意:在继续之前,请在Google帐户中启用2因子身份验证。
较不安全的应用程序( https://myaccount.google.com/u/0/u/0/secureapps )选项不再可用。
而是使用另一种使用Google提供的AppPassword的方式。
https://myaccount.google.com/u/0/apppasswords
由Google提供的代码而不是密码,这将用作身份验证令牌。
Note: please enable 2-factor authentication in google account before proceeding.
Less secure apps (https://myaccount.google.com/u/0/lesssecureapps) options is no longer available.
Instead use another way of using apppasswords provided by google.
https://myaccount.google.com/u/0/apppasswords
Use 16 digit code provided by google instead of password and that will serve as authentication token.
对于那些遵循其他答案但仍会在使用应用程序密码时仍会遇到“身份验证失败”错误的人,一个关键是,如果您使用该解决方案,则该解决方案不适用于XOAUTH2,或者遵循指南的指南,说使用OAuth2。
因此,在以下代码中:
只需将其更改为以下内容:
它应该起作用,使所有其他方面都保持不变。
To those who followed the other answers but are still getting the "Authentication Failed" error when using an app password, a key point is that this solution is NOT working for XOAUTH2 if you are using that or are following a guide saying to use oauth2.
So in the following code:
Simply change it to the following:
and it should work, keeping all else the same.