Gmail smtp not able to send email javax.mail.AuthenticationFailedException:

I have set gmail for less secure app already Also set IMAP forwarding

Locally sending emails works but the problem occurs in

digital ocean droplet [without ssl or domain] via ip address

Email Setting using java simple mail

private EmailMailer(){
        setMailer(new Mailer(new ServerConfig("", 587,EmailConstants.EMAIL_ID, EmailConstants.EMAIL_PASSWORD),

Checked Digital ocean was able to connect to port 587

Getting error while sending mail

Caused by: javax.mail.AuthenticationFailedException: 534-5.7.14 <
ww-app_1    | 534-5.7.14 ywow3CZ7TbpX5mHNs0LChqgXAsXoucspMfedy2oAIDqjP0MH4RO8M_1bLvhh6f3Ha0Fj_a
ww-app_1    | 534-5.7.14 RhfPx0WlDHIfsXUR8rbVLiSrSAr-hfc0PsOweMs0xMqQhHb6LhXMusyjtsfGzF> Please
ww-app_1    | 534-5.7.14 log in via your web browser and then try again.
ww-app_1    | 534-5.7.14  Learn more at
ww-app_1    | 534 5.7.14 a6sm8956026qth.74 - gsmtp
ww-app_1    | 
ww-app_1    |   at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(
ww-app_1    |   at com.sun.mail.smtp.SMTPTransport.authenticate(
ww-app_1    |   at com.sun.mail.smtp.SMTPTransport.protocolConnect(
ww-app_1    |   at javax.mail.Service.connect(
ww-app_1    |   at javax.mail.Service.connect(
ww-app_1    |   at javax.mail.Service.connect(
ww-app_1    |   at org.simplejavamail.mailer.internal.mailsender.MailSender.sendMailClosure(
ww-app_1    |   ... 59 more

Disculpe a logrado solucionar este problema, yo me encuentro con el mismo problema.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello, @cbondy

Can you confirm if you have 2 factor authentication enabled as well? I had a similar case and I’ve needed to turn less secure app ON test my code and and then turn it off again.

Have you tried doing so?

Regards, Alex