0 Replies Latest reply on Dec 31, 2007 10:33 AM by 843789

    Exception in thread "main" javax.mail.MessagingException: [EOF]

      hi i have a new Application which i need to send Email from it to people
      i have tried the code in my university pc's and i works soo fine...but in my home
      it gave my error
      here is the code
      import javax.mail.*;
      import javax.mail.internet.*;
      import java.util.*;
      public class TestMail
           public static void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException
               boolean debug = false;
                //Set the host smtp address
                Properties props = new Properties();
                props.put("mail.smtp.host", "mx2.hotmail.com");
               // create some properties and get the default Session
               Session session = Session.getDefaultInstance(props, null);
               // create a message
                    Message msg = new MimeMessage(session);
               // set the from and to address
               InternetAddress addressFrom = new InternetAddress(from);
               InternetAddress[] addressTo = new InternetAddress[recipients.length];
               for (int i = 0; i < recipients.length; i++)
                   addressTo[i] = new InternetAddress(recipients);
           msg.setRecipients(Message.RecipientType.TO, addressTo);

           // Optional : You can also set your custom headers in the Email if you Want
           msg.addHeader("MyHeaderName", "myHeaderValue");

           // Setting the Subject and Content Type
           msg.setContent(message, "text/plain");
           public static void main(String args[])throws MessagingException
                String mailers[] = new String[1];
                mailers[0] = "chocolate_guy_1986@hotmail.com";
                postMail(mailers,"hello","hello my dear ay","born.4.u@hotmail.com");
      and  here is the output of the programe(the error)
      Exception in thread "main" javax.mail.MessagingException: [EOF]
      at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1481)

      at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
      at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
      at javax.mail.Transport.send0(Transport.java:189)
      at javax.mail.Transport.send(Transport.java:118)
      at TestMail.postMail(TestMail.java:39)
      at TestMail.main(TestMail.java:45)
      Press any key to continue . . .
      plz help meee
      Edited by: mld on Dec 30, 2007 9:37 AM
      Edited by: mld on Dec 31, 2007 2:32 AM