Search code examples
javagmailgmail-api

Getting error while sending email through Gmail


Here I am trying to send mail using gmail but getting error below

  javax.mail.AuthenticationFailedException: 534-5.7.14 
  <https://accounts.google.com/ContinueSignIn? 
  sarp=1&scc=1&plt=AKgnsbu7f
  534-5.7.14 Zt- 
  ibTxZf1iCvRrx_zqZ2e0gyU7UDBdKNf3Skj3y1daBQ4lwKDtlbWjuZVSBdqqJvWssPG
  534-5.7.14 
  axQ9afV4DYvgwRA6V94E2JKjGlqxgk8V7wxG9-lgPZoqbzI4rgBIk8SjDYwFt06r7tzWjs

  534-5.7.14 gn4zN1UWm-
 _BhrTGzjP02vV710gi2NHsgX7efxMTbZSowI02n1DL31Qhf_ba5vvtN8mSkI
  534-5.7.14 mutNhiGJSG0_sSI0ZAiblBGGfc1o> Please log in via your web browser and
  534-5.7.14 then try again.
  534-5.7.14  Learn more at
  534 5.7.14  https://support.google.com/mail/answer/78754     vy6sm35491986pac.38 - gsmtp

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:648)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:583)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)

I have been logged-in successfully inside my web browser but getting error while sending through code. I haven't activated 2-step verification. I am following these link


Solution

  • Do login-to gmail via web browser and click Clik-this.select turn-on button.Once you select you will be able to send mail.