虽然可以将Gmail / Google Apps用作SMTP服务器以供脚本使用或在任何其他应用中使用。 我开始收到错误消息:
SMTP Error: 454 4.7.0 Too many login attempts, please try again later.
有时你会得到,有时你不会得到这样的错误。
答案 0 :(得分:3)
问题在于Google Apps安全保护。 您不能使用超过2个应用程序的相同电子邮件ID。 因为Gmail需要同步它,并且显然会收到此类错误。
即使设置SPF / TXT / DKIM记录也不够。
因此,请尝试为不同的应用程序使用不同的电子邮件ID。
答案 1 :(得分:0)
由于我们使用 gmail 发送电子邮件,因此我们需要在 gmail 帐户上启用“安全性较低的访问”。从浏览器注销所有 Google 帐户。登录 application.properties 中配置的 gmail 帐户。然后点击这个 link and turn on access for less secure apps。在某些情况下,您可能还需要访问此 link!如果不按照这些步骤操作,会出现以下错误,
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again.
Caused by: javax.mail.AuthenticationFailedException: 454 4.7.0 Too many login attempts, please try again later. m1sm1809073wmq.36 - gsmtp
注意,您的账户密码不能是普通密码,而是为您的google账户生成的应用密码。关注this link to see the details and to generate your Google App Password。
注意:Google 现在要求您在设置应用程序密码之前启用两步验证。