This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes please clear me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "please clear me" Watch "please clear me" New topic

please clear me

ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
please clear me

step 1:

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SimpleSendMessage
public static void main(String[] args)
String host="";
String to="";
String from="";

String subject=" THUSHARA PG COLLEGE..";

String messageText=" i am sending a message using the JAVA API \n";

boolean sessionDebug=false;

Properties prop=System.getProperties();

Session session=Session.getDefaultInstance(prop,null);


Message msg=new MimeMessage(session);
msg.setFrom(new InternetAddress(from));

InternetAddress []address={new InternetAddress(to)};

msg.setSentDate(new Date());

catch(MessagingException e)


step 2: james server is running in my localhost
step 3: i connected to internet



javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command f
irst. l22sm336876waf.10

at javax.mail.Transport.send0(
at javax.mail.Transport.send(
at SimpleSendMessage.main(

please clear me
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39578
I'm not sure what is happening exactly, but for tracking down a problem it's a good idea to turn on session debugging. That produces all kinds of useful output. Secondly, when using gmail as the server you'll need to add authentication and provide your password. Lastly, if you want to use a locally running server, you'll need to use "localhost" as server, not gmail.
[ April 08, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - updated with new look and Ping home screen widget
Fabian Gutierrez

Joined: Aug 15, 2004
Posts: 22
if you want to test locally, you could try apache james..


SCJP 1.4, SCWCD 1.4, SCBCD 5, SCJD 5
I agree. Here's the link:
subject: please clear me
Similar Threads
JavaMail Exception.......HELP!!
Email with jsp
JSP using javamail
java mail
Java Mail Send Failed error