This week's book giveaway is in the Android forum.
We're giving away four copies of Learning Java by Building Android Games and have Jean-Marcel Belmont on-line!
See this thread for details.
Win a copy of Learning Java by Building Android Games this week in the Android 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Issue with email sending  RSS feed

 
Ranch Hand
Posts: 444
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,



 
Master Rancher
Posts: 3673
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: 444
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: 90
4
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!