This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to send email using JavaMail API:getting error Must issue a STARTTLS command first. o1sm34552

 
Monica Shiralkar
Ranch Hand
Posts: 826
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to send email using java mail API. I tried to run code (below in the email) but am getting error below error message:

com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. o1sm34552478pax.2 - gsmtp

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2109)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1610)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1118)
at javax.mail.Transport.send0(Transport.java:195)
at javax.mail.Transport.send(Transport.java:124)
at SendMailBySite.main(SendMailBySite.java:35)


Below is the code I am using:





Please advice how to get rid of this error message and send mail successfully.

Thanks.
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaMail FAQ has an entry explaining how to access Gmail via JavaMail.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic