• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Sending email GMAIL account

 
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to send an email using Spring and Javamail. It doesn't recognize my Gmail credentials.




I get the error :




Could it be that the username should no be username@gmail.com?

Regards,
Angus
 
Ranch Hand
Posts: 86
1
 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still using the whole email as username I get the same error.
 
Marshal
Posts: 4662
301
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you been through the troubleshooting tips as suggested by Google? They helpfully gave you a link in the response error.

https://support.google.com/mail/?p=BadCredentials
 
Saloon Keeper
Posts: 5765
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also take note of the JavaMail FAQ entry about Gmail: https://javaee.github.io/javamail/FAQ#gmail
 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Have you been through the troubleshooting tips as suggested by Google? They helpfully gave you a link in the response error.



It is only for windows app and I am developing a Linux open-source one.
 
Tim Moores
Saloon Keeper
Posts: 5765
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Angus Ferguson wrote:It is only for windows app and I am developing a Linux open-source one.


I just looked at that page, and there's nothing at all specifically about Windows in it (or any other OS, for that matter).
 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I just looked at that page, and there's nothing at all specifically about Windows in it (or any other OS, for that matter).



Google accounts don't give you the possibility to generate a 16 digit password associated with a Linux device.
 
Tim Cooke
Marshal
Posts: 4662
301
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm totally confused too about the Windows comment.... all I see it information about authenticating to your Google account. I was thinking it might be something to do with 2-Step or not 2-Step verification
 
Saloon Keeper
Posts: 2679
335
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Angus Ferguson wrote:Could it be that the username should no be username@gmail.com?


username should be the full email address, not just the user-part.  For example: example@gmail.com
 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Username should be the full email address, not just the user-part.  For example: example@gmail.com



I am using the full email address as username the same error persists.
 
Master Rancher
Posts: 4208
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the account you are accessing set up to allow less secure apps?
 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a new example from the internet.



The email here in the ranch is fake but the one I using is real. I am using Linux Centos in a VirtualCloud and my Tomcat is running in local.

I get the message "Sent message successfully...."

Any error at all...

 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried mailtrap to simulate a real SMTP behaviour and it sends the email correctly.

 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well finally I just deleted the 2 step authentication method from my Gmail account and it worked correctly.
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!