1 Reply Latest reply: Jan 26, 2013 1:30 PM by bshannon RSS

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

    Prasad K T
      Hi.
      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 = "web@gmail.com";
      Properties properties = System.getProperties();
      properties.setProperty("mail.smtp.host", host);
      Session session = Session.getDefaultInstance(properties);
      try{
      MimeMessage message = new MimeMessage (session);
      message.setFrom(new InternetAddress(from));
      message.addRecipient(Message.RecipientType.TO,new InternetAddress("to"));
      message.setSubject(subj);
      message.setText(body);
      Transport.send(message);
      System.out.println ("Sent Message Successfully");

      }
      catch(MessagingException max){
      max.printStackTrace();
      }
      return null;
      }



      Am getting the exception as below

      javax.mail.MessagingException: [EOF]
      at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)
      at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1512)
      at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1321)
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:637)
      at javax.mail.Transport.send0(Transport.java:189)
      at javax.mail.Transport.send(Transport.java:118)
      at view.SendMail.send(SendMail.java:78)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.el.parser.AstValue.invoke(Unknown Source)
      at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)

      Could any one pls help me?

      regards,
      Prasad K T.