jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Java mail using gmail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java mail using gmail" Watch "Java mail using gmail" New topic

Java mail using gmail

blv krishna

Joined: Sep 27, 2009
Posts: 18
Hi All,

I wrote the following to send mail using java.

But i got the following ERROR.

SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first

Anyone please help me to reslove this error.

Steve Luke

Joined: Jan 28, 2003
Posts: 4181

Hi welcome to CodeRanch :-)

First, when you post code can you please use code tags? You can use the by putting [code][/code] tags around the code, or by using the Code button at the top of the message form. The code tags make it a lot easier to read your code. You can go ahead and add the code tags back into the message now using the button.

To your question. It looks like if you add the following line to your code, prior to sending the message, it works.

blv krishna

Joined: Sep 27, 2009
Posts: 18
Hi Steve,

After adding the below statement also i am getting the same error.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Have you read the section about Gmail in the JavaMail FAQ yet?
I agree. Here's the link: http://aspose.com/file-tools
subject: Java mail using gmail
It's not a secret anymore!