允许安全性较低的应用程序:开,但Heroku仍会生成该错误 [英] Allow less secure apps: ON But Heroku still generating that error

查看:49
本文介绍了允许安全性较低的应用程序:开,但Heroku仍会生成该错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Gmail地址和SMTP服务器发送电子邮件.允许不太安全的应用程序也是:开启,但仍然显示错误.看看我的错误.

I am trying to send email using gmail address and using SMTP server. Allow less secure apps is also: ON but it still showing me error. Have a look to my error.

2020-05-10 03:41:46.271 ERROR 4 --- [io-28157-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbs
2020-05-10T03:41:46.272499+00:00 app[web.1]: 534-5.7.14 1mTsyt_ByBxbJFjBCrrfuQ0x5r8TO5QSVf0h_ktBC7fucRfLRvWna76w1YDEo380J4Peu
2020-05-10T03:41:46.272500+00:00 app[web.1]: 534-5.7.14 5QKpfd_AbPn53AnFbcCB5A4Rwl8l7vnzZq3wThCJEDIDVdfkKlzCFWoPom99k_Sm>
2020-05-10T03:41:46.272500+00:00 app[web.1]: 534-5.7.14 Please log in via your web browser and then try again.
2020-05-10T03:41:46.272501+00:00 app[web.1]: 534-5.7.14  Learn more at
2020-05-10T03:41:46.272502+00:00 app[web.1]: 534 5.7.14  https://support.google.com/mail/answer/78754 k127sm4954870qkb.35 - gsmtp
2020-05-10T03:41:46.272502+00:00 app[web.1]: ] with root cause
2020-05-10T03:41:46.272503+00:00 app[web.1]: 
2020-05-10T03:41:46.272504+00:00 app[web.1]: javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbs
2020-05-10T03:41:46.272527+00:00 app[web.1]: 534-5.7.14 1mTsyt_ByBxbJFjBCrrfuQ0x5r8TO5QSVf0h_ktBC7fucRfLRvWna76w1YDEo380J4Peu
2020-05-10T03:41:46.272528+00:00 app[web.1]: 534-5.7.14 5QKpfd_AbPn53AnFbcCB5A4Rwl8l7vnzZq3wThCJEDIDVdfkKlzCFWoPom99k_Sm>
2020-05-10T03:41:46.272528+00:00 app[web.1]: 534-5.7.14 Please log in via your web browser and then try again.
2020-05-10T03:41:46.272529+00:00 app[web.1]: 534-5.7.14  Learn more at
2020-05-10T03:41:46.272529+00:00 app[web.1]: 534 5.7.14  https://support.google.com/mail/answer/78754 k127sm4954870qkb.35 - gsmtp
2020-05-10T03:41:46.272529+00:00 app[web.1]: 
2020-05-10T03:41:46.272530+00:00 app[web.1]:    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:965) ~[javax.mail-1.6.2.jar!/:1.6.2]
2020-05-10T03:41:46.272530+00:00 app[web.1]:    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:876) ~[javax.mail-1.6.2.jar!/:1.6.2]
2020-05-10T03:41:46.272531+00:00 app[web.1]:    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:780) ~[javax.mail-1.6.2.jar!/:1.6.2]
2020-05-10T03:41:46.272531+00:00 app[web.1]:    at javax.mail.Service.connect(Service.java:366) ~[javax.mail-1.6.2.jar!/:1.6.2]
2020-05-10T03:41:46.272532+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:517) ~[spring-context-support-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272533+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:436) ~[spring-context-support-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272533+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:360) ~[spring-context-support-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272534+00:00 app[web.1]:    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:355) ~[spring-context-support-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272534+00:00 app[web.1]:    at com.EmailSender.service.EmailService.sendEmail(EmailService.java:45) ~[classes!/:0.0.1-SNAPSHOT]
2020-05-10T03:41:46.272534+00:00 app[web.1]:    at com.fypRest.Controller.DonnerController.newDonner(DonnerController.java:51) ~[classes!/:0.0.1-SNAPSHOT]
2020-05-10T03:41:46.272535+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_252-heroku]
2020-05-10T03:41:46.272535+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_252-heroku]
2020-05-10T03:41:46.272536+00:00 app[web.1]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_252-heroku]
2020-05-10T03:41:46.272536+00:00 app[web.1]:    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_252-heroku]
2020-05-10T03:41:46.272537+00:00 app[web.1]:    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272537+00:00 app[web.1]:    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272538+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272539+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272539+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
2020-05-10T03:41:46.272540+00:00 app[web.1]:    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]

然后在application.properties中进行编码.

And code in application.properties.

spring.mail.default-encoding=UTF-8
spring.mail.host=smtp.gmail.com
spring.mail.username=xxxxxxxxxxxxxxxx@gmail.com
spring.mail.password=***********
spring.mail.port=587
spring.mail.protocol=smtp
spring.mail.test-connection=false
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true

我该如何解决?如果您需要了解其他详细信息,请告诉我,我将提供更多详细信息.

How can I solve it? If some other details you need to understand please tell me I will provide more details.

推荐答案

我通过允许使用此链接 https://accounts.google.com/b/0/DisplayUnlockCaptcha

I fix this error by allowing access to my google account using this link https://accounts.google.com/b/0/DisplayUnlockCaptcha

允许安全性较低的应用已启用,但由于安全原因,谷歌阻止了身份验证.当我打开Gmail时,我发现了用于检查活动的新安全性gmail(有些尝试在30分钟之前登录您的帐户并检查活动),然后单击是!是我".现在它为我工作."

Allow less secure apps was already ON but due to security reason google was preventing the authentication. When I open Gmail, I found new security gmail to check activity (some try to login your account before 30 mints, check activity) and click "yes! it was me". Now it's working for me."

这篇关于允许安全性较低的应用程序:开,但Heroku仍会生成该错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆