This discussion is archived
1 Reply Latest reply: Jan 26, 2013 11:30 AM by bshannon RSS

javax.mail.mailexception while am trying to send the mail

Prasad K T Explorer
Currently Being Moderated
Am trying to send a mail from ADF Application am using SMTP Server to send the mail
I have added javamail.jar in my libraries
This is the code am using to send

public String send() {
// Add event code here...
String to;
to = new String();
String host = "localhost";
String from = "";
Properties properties = System.getProperties();
properties.setProperty("", host);
Session session = Session.getDefaultInstance(properties);
MimeMessage message = new MimeMessage (session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,new InternetAddress("to"));
System.out.println ("Sent Message Successfully");

catch(MessagingException max){
return null;

Am getting the exception as below

javax.mail.MessagingException: [EOF]
at com.sun.mail.smtp.SMTPTransport.issueCommand(
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(
at com.sun.mail.smtp.SMTPTransport.finishData(
at com.sun.mail.smtp.SMTPTransport.sendMessage(
at javax.mail.Transport.send0(
at javax.mail.Transport.send(
at view.SendMail.send(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)

Could any one pls help me?

Prasad K T.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points