0

I'm trying to configure a simple contact form for my webpage. I'm getting this stacktrace:

Caused by: javax.mail.AuthenticationFailedException: 
534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsFU
534-5.7.14 MKoUlkf2Neav16XnOM73Jlc2ZJGyh4aH0ufasdsFAavSZ0zZsUhPVyLuGIT7ovkWxFGIZe3i1
534-5.7.14 GXvzNckga4f3-2reqdsa_hQQUNIpw318l2zbJvNfyM6vs-cMwYeE4b1UBWWbuzrRTD1piAemlc
534-5.7.14 -LXFDg959rb0iyXpM-yewLkDUFand3tpgb4GTIcbtnl0J2SUwwgSw42OOd-oHfionK6ESjJ5Q
534-5.7.14 vx1CK0Bcv0LngW2PBP5G_yQfewBQ0Uw> 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/bin/answer.py?answer=78754 b141sm930933qka.11 - gsmtp
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:823) ~[mail-1.4.5.jar:1.4.5]
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:756) ~[mail-1.4.5.jar:1.4.5]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673) ~[mail-1.4.5.jar:1.4.5]
at javax.mail.Service.connect(Service.java:317) ~[mail-1.4.5.jar:1.4.5]
at javax.mail.Service.connect(Service.java:176) ~[mail-1.4.5.jar:1.4.5]

This is my configuration,

smtp.host=smtp.gmail.com
smtp.port=465
smtp.ssl=true
smtp.tls=true
smtp.user="myemail@gmail.com"
smtp.password=xxxxxx
Marek J
  • 1,364
  • 8
  • 18
  • 33
  • "Please log in via your web browser and then try again" - do you have 2 factor authentication or anything set up? – Steve Chaloner May 06 '15 at 11:58
  • i don't have 2 factor auth @SteveChaloner – Nicolas Schejtman May 06 '15 at 15:24
  • Could be a duplicate of http://stackoverflow.com/questions/20337040/gmail-smtp-debug-error-please-log-in-via-your-web-browser – Steve Chaloner May 06 '15 at 20:04
  • @NicolasSchejtman Have you followed the instructions from https://support.google.com/mail/answer/78754 ? – Salem May 06 '15 at 22:33
  • @Salem yes I have! I found a solution while running in my local host, but I get the same error while running in my digitalocean server. Instead of using the myemail@gmail.com as the smtp user y used just myemail w/out the host. Any ideas? – Nicolas Schejtman May 09 '15 at 17:18
  • You may need to review notifications from Google related to account activity, flag them as acceptable and potentially allow less secure apps access to your Google account as mentioned in the instruction referenced by @Salem. – Sergey V. Aug 04 '15 at 03:10

2 Answers2

1

I used :

"com.typesafe.play" %% "play-mailer" % "2.4.1"

At the end this config worked :

smtp.host=smtp.gmail.com
smtp.auth=true
smtp.port=587
smtp.tls=yes
smtp.ssl=no
smtp.user = "****@gmail.com"
mail.smtps.debug = true
smtp.password = "****"

I had to enable this setting

https://www.google.com/settings/security/lesssecureapps
Jiro Matchonson
  • 875
  • 1
  • 17
  • 24
0

I found a solution instead of using "myemail@gmail.com" as the user, I just used the local part "myemail". However, this works fine on my local host but failed on my server. I tried enabling access for less secure applications and allowing the server IP to access my account, but neither worked. Finally I've ended up creating a new email address and using that one for sending email. This solution suits me, but it isn't optimal :S