Posted By:
srinivasa_gopalan
Posted On:
Wednesday, December 6, 2006 09:13 AM
Hi Experts, I had written a program to idle on an IMap server and fetch the mail whenever a mail arrives at the inbox. This works perfectly on Microsoft Exchange Server, Surge Mail(IMAP) and other few IMAP servers both securely ans otherwise. Wehn I try to connect the same to Sun Messaging Server I get a big fat exception. This is the Code Properties props = System.getProperties(); props.setProperty("mail.imap.socketFactory.port", "143"); props.setProperty("mail.imap.auth.plain.disable","true"); ResourceBundle bundle=ResourceBundle.getBundle("mail"); Session session = Session.getDefaultInstance(prop
More>>
Hi Experts,
I had written a program to idle on an IMap server and fetch the mail whenever a mail arrives at the inbox. This works perfectly on Microsoft Exchange Server, Surge Mail(IMAP) and other few IMAP servers both securely ans otherwise. Wehn I try to connect the same to Sun Messaging Server I get a big fat exception.
This is the Code
Properties props = System.getProperties();
props.setProperty("mail.imap.socketFactory.port", "143");
props.setProperty("mail.imap.auth.plain.disable","true");
ResourceBundle bundle=ResourceBundle.getBundle("mail");
Session session = Session.getDefaultInstance(props,null);
store = session.getStore("imap");
session.setDebug(true);
String user="myusername";
String password = "mypassword";
store.connect(popServer, user, password);
This is the stacktrace(I have enabled the imap debug as well):
DEBUG: setDebug: JavaMail version 1.4.1ea-SNAPSHOT
* OK [CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ NAMESPACE UIDPLUS CHILDREN BINARY LANGUAGE XSENDER X-NETSCAPE XSERVERINFO AUTH=PLAIN] Messaging Multiplexor (Sun Java(tm) System Messaging Server 6.2-3.05 (built Nov 23 2005))
IMAP DEBUG: AUTH: PLAIN
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ NAMESPACE UIDPLUS CHILDREN BINARY LANGUAGE XSENDER X-NETSCAPE XSERVERINFO AUTH=PLAIN
A0 OK CAPABILITY completed
IMAP DEBUG: AUTH: PLAIN
A1 LOGIN myuser mypassword
javax.mail.MessagingException: * BYE JavaMail Exception: java.net.SocketException: Connection reset;
nested exception is:
com.sun.mail.iap.ConnectionException: * BYE JavaMail Exception: java.net.SocketException: Connection reset
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:476)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at com.gavs.mail.receiver.MailReceiver.receive(MailReceiver.java:70)
at com.gavs.mail.receiver.MailReceiver.poll(MailReceiver.java:36)
at com.gavs.calendar.server.HTTPPushServer$4.run(HTTPPushServer.java:72)
Caused by: com.sun.mail.iap.ConnectionException: * BYE JavaMail Exception: java.net.SocketException: Connection reset
at com.sun.mail.iap.Protocol.handleResult(Protocol.java:315)
at com.sun.mail.imap.protocol.IMAPProtocol.login(IMAPProtocol.java:307)
at com.sun.mail.imap.IMAPStore.login(IMAPStore.java:521)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:456)
... 5 more
Any help would be greatly appreciated
Thanks in Advance
Srinivas
<<Less