• 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
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Sending email GMAIL account

 
Ranch Hand
Posts: 1398
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: 87
1
 
Angus Ferguson
Ranch Hand
Posts: 1398
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.
 
Sheriff
Posts: 4705
309
IntelliJ IDE Python Java Linux
  • 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: 5915
152
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: 1398
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: 5915
152
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: 1398
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
Sheriff
Posts: 4705
309
IntelliJ IDE Python Java Linux
  • 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: 2801
367
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: 1398
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: 4371
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: 1398
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: 1398
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: 1398
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.
 
It's exactly the same and completely different as this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!