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);
         session.setDebug(debug);
         // create a message
              Message msg = new MimeMessage(session);
         // set the from and to address
         InternetAddress addressFrom = new InternetAddress(from);
         msg.setFrom(addressFrom);
         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.setSubject(subject);
     msg.setContent(message, "text/plain");
     Transport.send(msg);
     public static void main(String args[])throws MessagingException
          String mailers[] = new String[1];
          mailers[0] = "[email protected]";
          postMail(mailers,"hello","hello my dear ay","[email protected]");
}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
512)
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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

i have tried every thing
i put stmp.bebug in my code and it gave me the following (tis is a part of the output...the other is not important)
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: not loading file: C:\Program Files\Java\jdk1.5.0_06\jre\lib\javamail.addr
ess.map
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.5.0_06\jre\lib\
javamail.address.map (The system cannot find the file specified)
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
512)
        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:43)
        at TestMail.main(TestMail.java:49)
Press any key to continue . . .

Similar Messages

  • Exception in thread "main" javax.mail.NoSuchProviderException: invalid prov

    HI,
    I am trying to read mails from my inbox i amgetting the ErrorC:\javamail>java
    Readmail
    Exception in thread "main" javax.mail.NoSuchProviderException: No provider for IMAP
            at javax.mail.Session.getProvider(Session.java:455)
            at javax.mail.Session.getStore(Session.java:530)
            at javax.mail.Session.getStore(Session.java:510)
            at Readmail.main(Readmail.java:24)My Code is    {
    String host = "hostname";
    String username = "user";
    String password = "password";
    // Create empty properties
    Properties props = new Properties();
    // Get session
    Session session = Session.getDefaultInstance(props,null);
    // Get the store
    Store store = session.getStore("IMAP");
    store.connect(host, username, password);
    // Get folder
    Folder folder = store.getFolder("Inbox");
    folder.open(Folder.READ_ONLY);
    // Get directory
    Message message[] = folder.getMessages();
    for (int i=0, n=message.length; i<n; i++)
       System.out.println(i + ": " + message.getFrom()[0]
    + "\t" + message[i].getSubject());
    // Close connection
    folder.close(false);
    store.close();
    I have also tried POP3 and MIME and SMTP
    Can anyone help me Thanks

    hi bshannon,
    I am getting the same error for others but for pop3 the error is as below
    Exception in thread "main" javax.mail.MessagingException: Connect failed;
      nested exception is:
            java.net.ConnectException: Connection refused: connect
            at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)
            at javax.mail.Service.connect(Service.java:275)
            at javax.mail.Service.connect(Service.java:156)
            at Readmail.main(Readmail.java:25)
    Caused by: java.net.ConnectException: Connection refused: connect
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
            at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
            at java.net.Socket.connect(Socket.java:452)
            at java.net.Socket.connect(Socket.java:402)
            at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
            at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
            at com.sun.mail.pop3.Protocol.<init>(Protocol.java:81)
            at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)
            at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)
            ... 3 more

  • Send mail through Java program. ERROR javax.mail.MessagingException: [EOF]

    Hi,
    i've a java Mail program which will send the mail thro smtp server.
    when i try to execute this program im getting the error javax.mail.MessagingException: [EOF]
    i've attached both code & error.
    while running the program need to give the arguments
    ex : java SendMail smtpserver frommailid tomailid subject body
    please provide me the solution.
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class SendMail {
         public static void main(String[] args) {
              try
         String smtpServer=args[0];
         String to=args[1];
         String from=args[2];
         String subject=args[3];
         String body=args[4];
         send(smtpServer, to, from, subject, body);
         catch (Exception ex)
         System.out.println("Usage: java SendMail"
         +" smtpServer toAddress fromAddress subjectText bodyText");
         System.exit(0);
         public static void send(String smtpServer, String to, String from
                   , String subject, String body)
                   try
                   Properties props = System.getProperties();
                   props.put("mail.smtp.host", smtpServer);
                   Session session = Session.getDefaultInstance(props, null);
                   Message msg = new MimeMessage(session);
                   msg.setFrom(new InternetAddress(from));
                   msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
                   msg.setSubject(subject);
                   msg.setText(body);
                   msg.setSentDate(new Date());
                   System.out.println("test 1--");
                   Transport.send(msg);
                   System.out.println("test 2--");
                   System.out.println("Message sent OK.");
                   catch (Exception ex)
                   ex.printStackTrace();
    thanks for the help in advance.
    regs
    lal.

    I ran into a similar error today. I fixed it by setting up SMTP authentication because my ISP's help pages said that they would allow only SMTP authentication.
    Here is what I did:
    Transport transport =
    mailConnection.getTransport("smtp");
    transport.connect(
    "hostname", "email", "password");
    Transport.send(msg);
    I also passed the following property while creating the session:
    props.put("mail.smtp.auth", "true");
    finally turning on debug helped:
    session.setDebug(true);
    session.setDebugOut(null);
    Hope this helps

  • Exception in thread "main" javax.naming.NoInitialContextException: Need to

    Hey,
    I am exploring the technique 'JMS'. I found an sample code on the Internet (https://www.redhat.gl/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/JMS_Examples-A_Point_To_Point_Example.html).
    But unfortunately, by running the code on my local computer, I got an NoInitialContextException (Exception in thread "main" javax.naming.NoInitialContextException: Need to ...Application resource file: java.naming.factory.initial). After searching on the Internet, I discovered I need to configure some JNDI values. But, also after passing on the variables to the class by parameter (-Djava.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory), I still get the same error.
    What have I forgotten? Hope someone can help. Thanks!
    Tongue78.
    public void setupPTP()
    throws JMSException,
    NamingException
    InitialContext iniCtx = new InitialContext();
    Object tmp = iniCtx.lookup("ConnectionFactory"); // exception occurs here..
    QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
    conn = qcf.createQueueConnection();
    que = (Queue) iniCtx.lookup("queue/testQueue");
    session = conn.createQueueSession(false,
    QueueSession.AUTO_ACKNOWLEDGE);
    conn.start();
    ....

    Refer to the Sun App Server documentation.
    http://docs.sun.com/source/819-0079/dgacc.htmlIt lists down the steps you need to follow.

  • Exception in thread "main" javax.naming.NameNotFoundException: Unable to re

    Hi friends,
    I am running simple Client program of JMS to produce text message. I have JMSServer under JMS tab in weblogic home site.my desnation is topic its name is topic2.Following Error occurs
    C:\j2sdk1.4.2_12\bin>java Client1
    Exception in thread "main" javax.naming.NameNotFoundException: Unable to resolve
    'topic1' Resolved [Root exception is javax.naming.NameNotFoundException: Unabl
    e to resolve 'topic1' Resolved ]; remaining name 'topic1'
    at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.j
    ava:108)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:284)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:244)
    at weblogic.jndi.internal.ServerNamingNode_813_WLStub.lookup(Unknown Sou
    rce)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:369)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:357)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at Client1.main(Client1.java:21)
    Caused by: javax.naming.NameNotFoundException: Unable to resolve 'topic1' Resolv
    ed
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
    NamingNode.java:897)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.jav
    a:230)
    at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.j
    ava:154)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:18
    8)
    at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
    ef.java:108)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    144)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
    a:415)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
    .java:30)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    C:\j2sdk1.4.2_12\bin>

    I am no expert to this but, I have gotten that error when I try to subscribe to a topic that does not exist.
    Make sure your server is running and that the topic exists.

  • Javax.mail.MessagingException: 505 Client was not authenticated

    Hi!,
    I got the following error:
    Exception in thread "main" javax.mail.MessagingException: 505 Client was not authenticated
    at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:507)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:312)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:168)
    at HelloMail.main(HelloMail.java:35)
    This is the code:
    To send an email I need authentification, and I include the mail.smtp.auth propertie and
    "message.saveChanges();
    Transport transport = session.getTransport("smtp");
    transport.connect("mail.xxx.com.mx","harriaga",passw);
    transport.sendMessage(message,message.getAllRecipients());
    transport.close();"
    Do you know if I am skip something.
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class HelloMail {
    public static void main(String args[]) throws Exception {
    String host="mail.xxx.com.mx"; //obviously doesn't work
    String from="[email protected]"; //sender's email
    String to ="[email protected]" ; //receiver's email
    Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.auth", "true");
    Session session=Session.getInstance(props,null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO, new
    InternetAddress(to));
    message.setSubject(" My Test HTML email ");
    message.setText(" Here is the content ");
    message.saveChanges();
    Transport transport = session.getTransport("smtp");
    transport.connect("mail.xxx.com.mx","harriaga",passw);
    transport.sendMessage(message,message.getAllRecipients());
    transport.close();
    Thanks for all,
    HAG.

    HAG,
    you need to create a session object passing a valid authenticator. In other words,
    MyAuthenticator auth = new MyAuthenticator ();
    Session session = Session.getInstance(props, auth);where MyAuthenticator is something like
    public class MyAuthenticator extends Authenticator{
      public PasswordAuthentication getPasswordAutentication(){
        return new PasswordAuthentication( "user", "password");
    }You obviously need to replace username and password with data valid for your e-mail account.
    Hope this helps,
    gulfi

  • Javax.mail.MessagingException: Could not connect to SMTP host:

    here is a part of my code
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class Mail {
    /** Creates a new instance of PostMail */
    public Mail() {
    public 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", "smtp."_____".com");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, null);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    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.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    Here is the exception i rec'vd
    javax.mail.MessagingException: Could not connect to SMTP host: smtp.google.com, port: 25;
    nested exception is:
    java.net.ConnectException: Connection refused: connect
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
    at javax.mail.Service.connect(Service.java:275)
    at javax.mail.Service.connect(Service.java:156)
    at javax.mail.Service.connect(Service.java:105)
    at javax.mail.Transport.send0(Transport.java:168)
    at javax.mail.Transport.send(Transport.java:98)
    at Mail.postMail(Mail.java:45)
    at ArchMain.<init>(ArchMain.java:30)
    at ArchMain$6.run(ArchMain.java:360)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:519)
    at java.net.Socket.connect(Socket.java:469)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
    ... 17 more

    package MailDao;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    import java.text.*;
    import java.text.DateFormat.* ;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.activation.*;
    import javax.mail.search.*;
    import java.util.Vector.*;
    import java.sql.*;
    public class SendMail {
    String SMTP_HOST_NAME = "smtp.techpepstechnology.com";//smtp.genuinepagesonline.com"; //techpepstechnology.com";
    String SMTP_AUTH_USER = "[email protected]"; //[email protected]"; //techpeps";
    String SMTP_AUTH_PWD = "demo"; //techpeps2007";
    public void postMail( String recipients[ ], String subject,
    String message , String from,String msgType) throws MessagingException {
    boolean debug = false;
    Properties props = System.getProperties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    props.put("mail.smtp.auth", "true");
    Authenticator auth = new SMTPAuthenticator();
    Session session = Session.getInstance(props, auth);
    session.setDebug(debug);
    // create a message
    MimeMessage msg = new MimeMessage(session);
    // MimeMessage mimemessage = new MimeMessage(simplemailuser.getSession());
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    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);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    if(msgType.equalsIgnoreCase("")) {
    //mimemessage.setText(s4);
    msg.setContent(message, "text/plain");
    else {
    MimeBodyPart textBodyPart = new MimeBodyPart();
    textBodyPart.setText(message);
    MimeBodyPart fileBodyPart = new MimeBodyPart();
    FileDataSource fds = new FileDataSource(msgType);
    fileBodyPart.setDataHandler(new DataHandler(fds));
    fileBodyPart.setFileName(fds.getName());
    //step:5 create the multipart/container to hold the part
    Multipart container = new MimeMultipart();
    container.addBodyPart(textBodyPart);
    container.addBodyPart(fileBodyPart);
    //step:6 add the multipart to the actual message
    msg.setContent(container);
    try{
    Transport transport=session.getTransport("smtp");
    transport.connect();
    transport.send(msg);
    transport.close();
    }catch(Exception e) {
    e.printStackTrace();
    private class SMTPAuthenticator extends javax.mail.Authenticator {
    public PasswordAuthentication getPasswordAuthentication() {
    String username = SMTP_AUTH_USER;
    String password = SMTP_AUTH_PWD;
    return new PasswordAuthentication(username, password);
    public static void main(String arg[]) {
    SendMail sm = new SendMail();
    String[] s ={"[email protected]"};
    try{
    sm.postMail(s,"hello","This is testing of mail","[email protected]","");
    catch(Exception e)
    e.printStackTrace();
    //sm.sendMsg("demo", "demo");
    System.out.println("Mail Sent");
    i also got the follwing error this code work fine in jcreator but i used this in netbeans it throws a exception
    plz.....help
    javax.mail.MessagingException: Could not connect to SMTP host: smtp.techpepstechnology.com, port: 25;
    nested exception is:
    java.net.ConnectException: Connection refused: connect
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:867)
    Mail Sent
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:156)
    at javax.mail.Service.connect(Service.java:256)
    at javax.mail.Service.connect(Service.java:135)
    at javax.mail.Service.connect(Service.java:87)
    at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:93)
    at MailDao.SendMail.postMail(SendMail.java:86)
    at MailDao.SendMail.main(SendMail.java:110)

  • Javax.mail.MessagingException: Unable to load BODYSTRUCTURE

    Hi.
    when i try receive message i have next exception. (But some message recieve without this problem). Can help me?
    Exception with Session debug:
    A12 FETCH 5 (ENVELOPE INTERNALDATE RFC822.SIZE)
    * 5 FETCH (INTERNALDATE "14-Dec-2006 08:46:20 -0500" RFC822.SIZE 35458 ENVELOPE ("Thu, 14 Dec 2006 15:46:13 +0200" "Fwd: Fwd: 123" (("s2mtestAIM" NIL "s2mtest" "aim.com")) (("s2mtestAIM" NIL "s2mtest" "aim.com")) (("s2mtestAIM" NIL "s2mtest" "aim.com")) ((NIL NIL "s2mtest" "aim.com")) NIL NIL "<[email protected]>" "<[email protected]>"))
    A12 OK FETCH completed
    FROM: s2mtestAIM <[email protected]>
    TO: [email protected]
    SUBJECT: Fwd: Fwd: 123
    SendDate: Thu Dec 14 15:46:13 EET 2006
    FLAGS: XAOL-GOODCHECK-DONE
    A13 FETCH 5 (BODYSTRUCTURE)
    * 5 FETCH (BODYSTRUCTURE (("TEXT" "HTML" ("CHARSET" "windows-1251") NIL NIL "QUOTED-PRINTABLE" 4071 146 NIL NIL NIL)("MESSAGE" "RFC822" ("NAME" "1.eml") NIL NIL "7BIT" 13251 NIL ("attachment" ("FILENAME" "1.eml")) NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 17777 ("Thu, 14 Dec 2006 13:17:25 +0200" "Fwd: 123" (("s2mtestAIM" NIL "s2mtest" "aim.com")) (("s2mtestAIM" NIL "s2mtest" "aim.com")) (("s2mtestAIM" NIL "s2mtest" "aim.com")) ((NIL NIL "s2mtest" "aim.com")) NIL NIL "<[email protected]>" "<[email protected]>") (("TEXT" "HTML" ("CHARSET" "windows-1251") NIL NIL "QUOTED-PRINTABLE" 3103 124 NIL NIL NIL)("MESSAGE" "RFC822" ("NAME" "1.eml") NIL NIL "7BIT" 3723 NIL ("attachment" ("FILENAME" "1.eml")) NIL)("MESSAGE" "RFC822" NIL NIL NIL "7BIT" 1658 ("Thu, 14 Dec 2006 12:36:23 +0200" "123" (("12323" NIL "resetdel" "gmail.com")) (("12323" NIL "resetdel" "gmail.com")) (("12323" NIL "resetdel" "gmail.com")) ((NIL NIL "s2mtest" "aol.com")) NIL NIL NIL "<[email protected]>") ("TEXT" "HTML" ("CHARSET" "windows-1251") NIL NIL "7BIT" 1658 0 NIL NIL NIL) 0 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "windows-1251") NIL NIL "QUOTED-PRINTABLE" 2063 97 NIL NIL NIL)("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 1697 35 NIL NIL NIL)("TEXT" "HTML" ("CHARSET" "windows-1251") NIL NIL "QUOTED-PRINTABLE" 2063 97 NIL NIL NIL) "MIXED" ("BOUNDARY" "----------87AC1A33733336A") NIL NIL) 440 NIL NIL NIL) "MIXED" ("BOUNDARY" "----------121BF2519BABDF9") NIL NIL))
    A13 OK FETCH completed
    javax.mail.MessagingException: Unable to load BODYSTRUCTURE
         at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1117)
         at com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:340)
    Thanks.

    Then it's a bug in the AIM IMAP server, please report it.
    I guess this deserves a FAQ entry. Here's what I'll add:
    Q: I can read messages from my IMAP server with other mail clients,
    but even though I can connect to the server using JavaMail, when I use
    JavaMail to read some messages it fails. Doesn't that mean there's a bug
    in JavaMail?
    A: No, not usually. Most other mail clients make very little
    use of the rich IMAP protocol. They use the IMAP protocol as little
    more than a variant of the POP3 protocol, typically downloading the
    entire message to the client and parsing it in the client. This allows
    them to avoid all sorts of parsing and protocol bugs in many IMAP
    servers, but of course it comes at the cost of being less efficient
    because they don't take advantage of the IMAP protocol's ability to
    fetch only the parts of the message that are needed. These server bugs
    often manifest themselves as the following exception on the client:
    javax.mail.MessagingException: Unable to load BODYSTRUCTURE
    The best approach when running into server bugs of this sort is to contact
    the vendor of the server and get them to fix their product. Contact
    [email protected] and we'll help you
    pinpoint the problem so that you can report it to the server vendor.
    If you can't get a fix from the server vendor, the following technique
    will often allow you to work around these server bugs:
        // Get the message object from the folder in the
        // usual way, for example:
        MimeMessage msg = (MimeMessage)folder.getMessage(n);
        // Use the MimeMessage copy constructor to make a copy
        // of the entire message, which will fetch the entire
        // message from the server and parse it on the client:
        MimeMessage cmsg = new MimeMessage(msg);
        // The cmsg object is disconnected from the server so
        // setFlags will have no effect (for example).  Use
        // the original msg object for such operations.  Use
        // the cmsg object to access the content of the message.

  • Exception in thread "main" java.lang.NoclassDefFoundError:javax/actiovation

    c:\>java Emailer
    Exception in thread "main" java.lang.NoclassDefFoundError:javax/actiovation/DataSource
    at Main.<inti><Main.java:36>
    at Main.<inti><Main.java:51>
    am getting the following error wen am try to run my code..
    i think am havin problem in settin the classpath for
    authentication.jar file
    and if poissible give me full code for sending email from maa system
    can any one tell me how to set the class path for the jar file and wer to download the jar file
    thanks in advance
    bye

    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import com.sun.mail.smtp.SMTPMessage;
    public class Emailer
         String subject;
         String body;
      public Emailer()
      public void sendEmail(String fromEmailAddr, String toEmailAddr, String ccEmailAddr, String aSubject, String aBody) throws AddressException
           subject = aSubject;
           body = aBody;
           Properties eMailConfigProps = new Properties();
      eMailConfigProps = System.getProperties();
    eMailConfigProps.put("mail.from",new InternetAddress(fromEmailAddr));
           eMailConfigProps.put("mail.smtp.host", "59.175.161.22");
          eMailConfigProps.setProperty("mail.smtp.port", "25");
      eMailConfigProps.put("mail.transport.protocol", "59.175.161.22");
           Session session = Session.getInstance(eMailConfigProps, null);
           MimeMessage message = new SMTPMessage(session);
              try
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmailAddr));
    message.addRecipient(Message.RecipientType.CC, new InternetAddress(ccEmailAddr));
                message.setSubject(subject);
                message.setText(body);
                Transport.send(message);
              catch (MessagingException ex)
                System.err.println("Cannot send email. " + ex);
    public static void main(String args[])
          Emailer objEmailer = new Emailer();
         try
              objEmailer.sendEmail("[email protected]","[email protected]","[email protected]","Test Mail","Hi am working...");
         catch(javax.mail.internet.AddressException e)
              e.printStackTrace();
    wen am trying to execute the about code .. itss showing the following error
    plz wat r the changes that i should do in that coding..
    even i got the code from this forum only
    plz tel me
    this is the error am getting :
    c:/>java Emailer
    cannto send email. javax.mail.MessagingException : Could not connect to SMTP host :192.168.15.100,port :25;
    nested exception is :java.net.ConeectException :Connecton refused:connect
    tis is the error am getting ..
    pplzz anyone help
    wat r the changess that i should do in maa programm .. wat is the ipaddress and port no i should put ..wer can i get these 2..
    thanks in advance
    bye

  • Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/stream

    I am trying to develop a web service client for amazon webservice.but i am getting this error while running the app. Can anyone please help me. I have installed the JWSDP and but could not understand why i have to locate all the jar files in the classpath?Please help.
    ===== error=========================================
    C:\abr\classes>java -classpath c:\abr\test.jar;C:\abr\jaxrpc-api.jar;C:\abr\jaxrpc-impl.jar;C:\abr\jaxrpc-spi.jar;c:\abr\classes\amazon.jar;C:\abr\mail.jar;C:\a
    br\saaj-api.jar;C:\abr\activation.jar;c:\abr\FastInfoset.jar;%classpath% Client
    [b]Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/stream/XMLS
    treamWriter
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.
    java:672)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:87)
    at amazon.AmazonSearchPort_Stub.authorSearchRequest(AmazonSearchPort_Stu
    b.java:988)
    at Client.main(Client.java:21)

    I'm assuming you're using JWSDP 1.6 as I see Fastinfoset.jar in your list. You are missing some jar files in your classpath there. The best way to know what you need is to look at the release notes for JWSDP 1.6. Since you're building a web serivce start with the table in there and lookup JAX-RPC. It'll show you what jar files are needed and what other libraries are needed. Now depending on what you're doing you don't really need all those.
    For sure you're missing jsr173_api.jar which is where I believe that class you need is located. This is in the JWSDP_1_6\sjsxp\lib directory. You will probably need the other jar thats in there too. Best bet is to follow the dependancy chart in the release notes.
    This should get you going.
    Ryan

  • Suddenly getting exception - javax.mail.MessagingException: * BYE System

    Hi,
    Suddenly over the last week my application keeps throwing exceptions. This didnt happened before, so the code base hasnt changed! The exception I get is below. Tried searching the internet and tried what was suggested, but this hasnt helped.
    javax.mail.MessagingException: * BYE System Error c63if10001534wej.179;
    nested exception is:
         com.sun.mail.iap.ConnectionException: * BYE System Error c63if10001534wej.179
         at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:616)
         at javax.mail.Service.connect(Service.java:291)

    Just remembered that there are demos with the libraries. I used the msgshow.java example. I changed it so that is just dumped the messages size. I wrapped this in a script so that the msgshow app gets called a 100 times. Anyway I get the same result.
    i.e.
    done 45 times
    Total messages = 444
    New messages = 0
    done 46 times
    Total messages = 444
    New messages = 0
    done 47 times
    Total messages = 445
    New messages = 0
    done 48 times
    Total messages = 445
    New messages = 0
    done 49 times
    Oops, got exception! * BYE System Error w20if10206000wem.32
    javax.mail.MessagingException: * BYE System Error w20if10206000wem.32;
    nested exception is:
         com.sun.mail.iap.ConnectionException: * BYE System Error w20if10206000wem.32
         at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:668)
         at javax.mail.Service.connect(Service.java:295)
         at msgshow.main(msgshow.java:151)
    Caused by: com.sun.mail.iap.ConnectionException: * BYE System Error w20if10206000wem.32
         at com.sun.mail.iap.Protocol.handleResult(Protocol.java:356)
         at com.sun.mail.imap.protocol.IMAPProtocol.login(IMAPProtocol.java:367)
         at com.sun.mail.imap.IMAPStore.login(IMAPStore.java:728)
         at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:648)
         ... 2 more
    done 50 times
    Total messages = 445
    New messages = 0
    done 51 times
    Total messages = 445
    New messages = 0
    Hope someone can help with this.

  • Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/S

    Hi,
    I have created a class JaxmClient.java. When I compile the class with appropriate jar files assigned to -classpath it compiles successfully with no errors. But when I run the classe "java JaxmClient" it produces the following exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SOAPElement
    Can someone help me I am knew to this technology.
    Thanks in advance

    I tried to use in my execution all the jar files that I used for compilation.
    java -cp jaxm-jar; etc.jar Request
    but it still gives me this execption
    Exception in thread "main" java.lang.NoClassDefFoundError: Request
    I am in the right directory where is the Request.class file is and it is present in this directory....
    Thanks appreciate your help...

  • Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/jai/

    Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/jai/
    After I got this exception, I tried the following solution:
    I downloaded the Windows package for JAI from this link:
    https://jai-imageio.dev.java.net/binary-builds.html
    Then I went to the Projects window > Libraries (Netbeans IDE) and browsed to the two jar files in that download. The two jar files are now showing under the Libraries node and, accordingly, they are listed in my Classpath as this:
    ..\..\..\Desktop\jai-imageio-1_2-pre-dr-b04-lib-windows-i586-07_Apr_2009\lib\ext\jai_imageio.jar
    ..\..\..\Desktop\jai-imageio-1_2-pre-dr-b04-lib-windows-i586-07_Apr_2009\lib\ext\clibwrapper_jiio.jar
    There also a couple of DLL files which I wasn't sure how to add.
    So why am I still getting this error? Maybe it's the wrong version of JAI?

    This research made me VERY late for work and I've been swamped all day. Didn't have a chance to post my solution earlier.
    "It appears that you have downloaded wrong package... try downloading and installing the stable release " jai_imageio-1_1-lib-windows-i586-jdk.exe ".
    I didn't know how to install that one. I tried clicking it and got an error msg. Then I added it as a reference (I browsed to it from the Libraries node) which "seemed" to work (allowed me to run my app using F6) but then it wouldn't produce a deployment package when I seleced Run > Clean and Build. So I went back and downloaded the "Daily Build" which unzips to two jar files
    jai_imageio.jar
    clibwrapper_jiio.jar
    and immedliately Run > Clean and Build produced a deployment package. (All of this is to get PDFbox running in my app). I also needed jai_core.jar which I believe was from this page:
    http://code.google.com/p/mapmap/downloads/detail?name=jai_core.jar&can=2&q=
    specifically this link:
    http://mapmap.googlecode.com/files/jai_core.jar
    By the way I am using a "Daily Build" for PDFbox (0.7.4) which came from the "FOP" downloads here:
    http://www.jeremias-maerki.ch/download/fop/pdf-images/
    but I still needed the older pdfbox 0.7.3 download just to extract the Fontbox.jar from it. I needed a codec from this page as well:
    http://www.findjar.com/jar/geoserver/jai/jars/jai_codec-1.1.3-alpha.jar.html
    the codec was offered as a one-link download:
    http://www.findjar.com/jar/geoserver/jai/jars/jai_codec-1.1.3-alpha.jar.html
    The upshot of all this is that I can now work with more types of PDF files than before - but still not all of them. I'm getting another error on some of them (I'll have to reproduce this at home).

  • SHA1 digest error for javax/mail/MessagingException

    java.lang.SecurityException: SHA1 digest error for javax/mail/MessagingException.class
         at sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:194)
         at java.util.jar.JarVerifier.processEntry(JarVerifier.java:201)
         at java.util.jar.JarVerifier.update(JarVerifier.java:188)
         at java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:411)
         at sun.misc.Resource.getBytes(Resource.java:97)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:256)
         at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    Exception in thread "main"
    What could be the problem for this error Exception ???
    Thanks and Regards.

    Hi!
    Do you use some plugins with eclipse IDE, like Tomcat by example or other plugins ... ?
    If yes, update mail.jar and activation.jar inside Tomcat or in your lib project Eclipse...
    You have a conflict with the class loader that check for security for class javax/mail/MessagingException
    See you Manifest.mf inside mail.jar :
    (old version here...)
    Manifest-Version: 1.0
    Implementation-Version: 1.4
    Specification-Title: JavaMail(TM) API Design Specification
    Specification-Version: 1.3
    Implementation-Title: javax.mail
    Extension-Name: javax.mail
    Created-By: 1.5.0 (Sun Microsystems Inc.)
    Implementation-Vendor-Id: com.sun
    Implementation-Vendor: Sun Microsystems, Inc.
    Specification-Vendor: Sun Microsystems, Inc.
    SCCS-ID: @(#)javamail.mf     1.6 05/12/09
    Name: javax/mail/search/SearchTerm.class
    SHA1-Digest: SwGnDhIUmpZhfhq/FKkCQ9nD7ZE=
    Name: javax/mail/SendFailedException.class
    SHA1-Digest: XdCEygaIZQB9YrH2WIr4nPRYYk0=
    Name: javax/mail/MessagingException.class
    SHA1-Digest: lfjX30OQ88v/n9G9fTJGqjFmPd0=
    regards,

  • Getting javax.mail.AuthenticationFailedException: EOF on socket. Need Help

    I am trying to get hotmail emails and store in Oracle 10g database.
    When I am executing receivemail procedure from Oracle 10g database. I am getting following error.
    connect to ESIMSCO_UTIL_OWNER
    SQL> set serveroutput on
    SQL>
    SQL> Declare
    2 v_error_msg varchar2(10000);
    3 Begin
    4 v_error_msg:=receivemail('pop3.live.com', '<My email address>@hotmail.com', '<My email password>');
    5 dbms_output.put_line(v_error_msg);
    6 End;
    7 /
    javax.mail.AuthenticationFailedException: EOF on socket
    PL/SQL procedure successfully completed.
    SQL>
    I did following steps, but still I am getting this error. Can somebady help me to solve this problem.
    connect sys/<password>@esimsco as sysdba
    connect to sys
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 30 16:02:04 2012
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> begin
    1 dbms_java.grant_permission( 'ESIMSCO_UTIL_OWNER', 'SYS:java.util.PropertyPermission', '*', 'read,write' );
    2 commit;
    3 end;
    4 /
    PL/SQL procedure successfully completed.
    SQL> begin
    2 dbms_java.grant_permission(
    3 grantee => 'ESIMSCO_UTIL_OWNER',
    4 permission_type => 'SYS:java.net.SocketPermission',
    5 permission_name => '*',
    6 permission_action => 'connect,resolve'
    7 );
    8 end;
    9 /
    PL/SQL procedure successfully completed.
    SQL> begin
    2 dbms_java.grant_permission(
    3 grantee => 'ESIMSCO_UTIL_OWNER',
    4 permission_type => 'SYS:java.util.PropertyPermission',
    5 permission_name => '*',
    6 permission_action => 'read,write'
    7 );
    8 end;
    9 /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL>
    Then I connect ESIMSCO_UTIL_OWNER.
    connect to ESIMSCO_UTIL_OWNER
    Create 2 tables.
    create table attachment(
    at_file varchar2(500),
    at_mimetype varchar2(500),
    at_attachment blob
    create table email (
    em_incident integer,
    em_from varchar2(1000),
    em_subject varchar2(1000),
    em_body nclob
    Then Create java source named receivemail.
    create or replace and compile java source named receivemail as
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    import java.sql.*;
    import sqlj.runtime.*;
    import oracle.sql.BLOB;
    public class ReceiveMail
    static void getAttachments(Message message, int incidentNo)
    throws MessagingException, IOException, SQLException {
    //String attachments = "";
    Object content = message.getContent();
    if (content instanceof Multipart)
    // -- Multi part message which may contain attachment
    Multipart multipart = (Multipart)message.getContent();
    // -- Loop through all parts of the message
    for (int i=0, n=multipart.getCount(); i<n; i++) {
    Part part = multipart.getBodyPart(i);
    String disposition = part.getDisposition();
    if ((disposition != null) &&(disposition.equals(Part.ATTACHMENT) || disposition.equals(Part.INLINE))) {
    //-- This part is a file attachment
    String fileName = incidentNo+"_"+part.getFileName().replace(' ','_');
    System.out.println("FILE: " + fileName);
    String contentType = part.getContentType();
    String mimeType = contentType.substring(0,contentType.indexOf(";"));
    System.out.println("FILETYPE: " + mimeType);
    InputStream is = part.getInputStream();
    // -- To work with a BLOB column you have to insert a record
    // -- with an emptly BLOB first.
    #sql { insert into attachment(at_file, at_mimetype, at_attachment)
    values (:fileName, :mimeType, empty_blob()) };
    // -- Retrieve the BLOB
    BLOB attachment = null;
    #sql { select at_attachment into :attachment
    from attachment where at_file = :fileName };
    // -- Fill the BLOB
    OutputStream os = attachment.getBinaryOutputStream();
    int j;
    while ((j = is.read()) != -1) {
    os.write(j);
    is.close();
    os.close();
    // -- Set the BLOB by updating the record
    #sql { update attachment set at_attachment = :attachment
    where at_file = :fileName };
    static String getPlainTextBody(Message message)
    throws MessagingException, IOException
    Object content = message.getContent();
    if (message.isMimeType("text/plain")) {
    // -- Message has plain text body only
    System.out.println("SIMPLE TEXT");
    return (String) content;
    } else if (message.isMimeType("multipart/*")) {
    // -- Message is multipart. Loop through the message parts to retrieve
    // -- the body.
    Multipart mp = (Multipart) message.getContent();
    int numParts = mp.getCount();
    System.out.println("MULTIPART: "+numParts);
    for (int i = 0; i < numParts; ++i) {
    System.out.println("PART: "+mp.getBodyPart(i).getContentType());
    if (mp.getBodyPart(i).isMimeType("text/plain")) {
    // -- Return the plain text body
    return (String) mp.getBodyPart(i).getContent();
    } else if (mp.getBodyPart(i).isMimeType("multipart/*")) {
    // -- Body is also multipart (both plain text and html).
    // -- Loop through the body parts to retrieve plain text part.
    MimeMultipart mmp = (MimeMultipart) mp.getBodyPart(i).getContent();
    int numBodyParts = mmp.getCount();
    System.out.println("MULTIBODYPART: "+numBodyParts);
    for (int j = 0; j < numBodyParts; ++j) {
    System.out.println("BODYPART: "+mmp.getBodyPart(j).getContentType());
    if (mmp.getBodyPart(j).isMimeType("text/plain")) {
    // -- Return the plain text body
    return (String) mmp.getBodyPart(j).getContent();
    return "";
    } else {
    System.out.println("UNKNOWN: "+message.getContentType());
    return "";
    static void saveMessage(Message message)
    throws MessagingException, IOException, SQLException
    //String body = "";
    int incidentNo;
    // -- Get a new incident number
    #sql { select seq_incident.nextval into :incidentNo from dual };
    // -- Get the header information
    String from = ((InternetAddress)message.getFrom()[0]).getAddress();
    System.out.println("FROM: "+ from);
    String subject = message.getSubject();
    System.out.println("SUBJECT: "+subject);
    // -- Retrieve the plain text body
    String body = getPlainTextBody(message);
    // -- Store the message in the email table
    #sql { insert into email (em_incident, em_from, em_subject, em_body)
    values (:incidentNo, :from, :subject, :body) };
    // -- Retrieve the attachments
    getAttachments(message, incidentNo);
    #sql { commit };
    // -- Mark message for deletion
    // message.setFlag(Flags.Flag.DELETED, true);
    public static String Receive(String POP3Server, String usr, String pwd)
    Store store = null;
    Folder folder = null;
    try
    // -- Get hold of the default session --
    Properties props = System.getProperties();
    props.put("mail.pop3.connectiontimeout", "60000");
    Session session = Session.getDefaultInstance(props, null);
    // -- Get hold of a POP3 message store, and connect to it --
    store = session.getStore("pop3");
    store.connect(POP3Server,995, usr, pwd);
    System.out.println("Connected");
    // -- Try to get hold of the default folder --
    folder = store.getDefaultFolder();
    if (folder == null) throw new Exception("No default folder");
    // -- ...and its INBOX --
    folder = folder.getFolder("INBOX");
    if (folder == null) throw new Exception("No POP3 INBOX");
    // -- Open the folder for read_write (to be able to delete message) --
    folder.open(Folder.READ_WRITE);
    // -- Get the message wrappers and process them --
    Message[] msgs = folder.getMessages();
    for (int msgNum = 0; msgNum < msgs.length; msgNum++){
    saveMessage(msgs[msgNum]);
    System.out.println("No more messages");
    return ("SUCCESS");
    catch (Exception ex){
    ex.printStackTrace();
    return ex.toString();
    finally{
    // -- Close down nicely --
    try{
    // close(true), to expunge deleted messages
    if (folder!=null) folder.close(true);
    if (store!=null) store.close();
    catch (Exception ex){
    //ex.printStackTrace();
    return ex.toString();
    Then create function receivemail.
    create or replace function receivemail(pop3_server in string,
    pop3_usr in string,
    pop3_pwd in string)
    return varchar2
    is language java name
    'ReceiveMail.Receive(java.lang.String,
    java.lang.String,
    java.lang.String) return String';
    And then trying to execute function receivemail, but I am getting following error.
    SQL> set serveroutput on
    SQL>
    SQL> Declare
    2 v_error_msg varchar2(10000);
    3 Begin
    4 v_error_msg:=receivemail('pop3.live.com', '<Hotmail email address>@hotmail.com', 'Hotmail password');
    5 dbms_output.put_line(v_error_msg);
    6 End;
    7 /
    javax.mail.AuthenticationFailedException: EOF on socket
    PL/SQL procedure successfully completed.
    SQL>
    I am requesting, please help me to solve this problem.
    I will be very thankful for your kind help and support.
    Amol......
    Edited by: Amol Karyakarte on 31-May-2012 7:27 AM

    Hello,
    I don't think this is the right forum, as this question seems to have nothing to do with the Oracle Forms tool.
    You'd better ask it in the database forum.
    Francois

Maybe you are looking for

  • Add new column to System report

    Hi experts! Can i add new column  to System Report ( Ex: Inventory Status, Agent Report which new Column as "Test") by SDK.) Please give me ideas. Thanks!

  • Multiple source values to single target in value mapping

    Hi Experts, I have to acheive below thing using value mapping. Source                        Target ABC                            111 CBA                            111 XYZ                             222 ZYX                             222 When I a

  • Illustrator slowing down after creating a pattern swatch

    I am creating pattern swatches in Illustrator and every time I do my computer slows down to the speed of tar in winter. Anyone have a solution? Anyone else had this problem before? Please help me!!! Muffin )

  • Custom TCODE-Auth Object Assignment

    Hello All- I see a very weird thing with custom TCODE assignment, here is what I see: 1)We have Display role which has all functions tcodes in it, which goes to every one on PRD. 2)Usually we assign custom tcodes which are not critical to this role,

  • Single click to execute automator script

    Relatively new to auto.., I created a workflow and saved the file. When I click on it, automator loads and sits there. How do I make the saved file a single click run? Kinda like an EXE in <sorry> Windows.