File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java mail using gmail" Watch "Java mail using gmail" New topic
Author

Java mail using gmail

blv krishna
Greenhorn

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
Bartender

Joined: Jan 28, 2003
Posts: 3948
    
  17

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.


Steve
blv krishna
Greenhorn

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

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

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

Have you read the section about Gmail in the JavaMail FAQ yet?
 
 
subject: Java mail using gmail
 
Similar Threads
how to mail send in servlets or jsp?
Transport.send problem
Java mail problem in IE
use Linux sendmail from Java
Error - The trustAnchors parameter must be non-empty