aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Unable to send email using JavaMail API:getting error Must issue a STARTTLS command first. o1sm34552 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Unable to send email using JavaMail API:getting error Must issue a STARTTLS command first. o1sm34552" Watch "Unable to send email using JavaMail API:getting error Must issue a STARTTLS command first. o1sm34552" New topic
Author

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

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 662
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
Bartender

Joined: Oct 14, 2005
Posts: 18887
    
    8

The JavaMail FAQ has an entry explaining how to access Gmail via JavaMail.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to send email using JavaMail API:getting error Must issue a STARTTLS command first. o1sm34552