Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!
  • 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Issue with email sending  RSS feed

 
Ranch Hand
Posts: 451
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a issue with gmail:





Sometimes it works, sometomes it is not working.

My exception is:

Sending the email to the following server failed : smtp.gmail.com:465

I send a email to Google and I am waiting a response.

Thanks,



 
Rancher
Posts: 3811
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you paste the full exception ans stack trace you get?
 
Dana Ucaed
Ranch Hand
Posts: 451
6
Netbeans IDE Oracle Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
=======send email start
null
=======end email
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. i10-v6sm8616244wmf.4 - gsmtp

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2343)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1808)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1285)
at javax.mail.Transport.send0(Transport.java:255)
at javax.mail.Transport.send(Transport.java:124)
at frameworkcontentspeed.Utils.SendEmailAtachament.SendEmailAnda(SendEmailAtachament.java:353)
at frameworkcontentspeed.Utils.SendEmailAtachament.main(SendEmailAtachament.java:479)
 
Ranch Hand
Posts: 113
5
MS IE Notepad Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you use SMTP on TCP/587 - this is PLAIN with STARTTLS
what you're doin: setting socketfactory to SSL - WRONG!

When you want to use socket level SSL - this is SMTPS (oh - and it's very wrong to use SMTP and set socketfactory to ssl - that's what's SMTPS for) - and runs on TCP/465. So remove that socketfactory crap and add mail.smtp.starttls true - that's the right way.

Also - if you have 2FA enabled - you need to use application passwords.
 
I'm full of tinier men! And a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!