HI, Iam trying to Integrate Exchange server using Java Mail
843834Mar 5 2009 — edited Mar 6 2009Here is what iam stuck with, I have a problem while conneting to Exchange Server using imap over ssl.
My code looks like this
props.put("mail.imap.host",host);
props.put("mail.imap.sasl.authorizationid","user1");
props.put("mail.imap.sasl.enable","true");
props.setProperty("mail.imap.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.imap.socketFactory.fallback","true");
props.setProperty("mail.imap.socketFactory.port","993");
Authenticator auth = new myauthenticator(AdminUserName,AdminPassword);
Session session = Session.getInstance(props,auth);
session.setDubug(true);
Store store = session.getStore("imap");
store.connect();
I get the following Exception as
javax.mail.MessagingException: Software caused connection abort: recv failed;
nested exception is:
java.net.SocketException: Software caused connection abort: recv failed
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:571)
at javax.mail.Service.connect(Service.java:310)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at MoveCalendar.move(MoveCalendar.java:63)
at SendCalendar.send(SendCalendar.java:74)
at SendCalendar.main(SendCalendar.java:40)
Caused by: java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.a(Unknown Source)
at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.iap.ResponseInputStream.readResponse(ResponseInputStream.java:97)
at com.sun.mail.iap.Response.<init>(Response.java:96)
at com.sun.mail.imap.protocol.IMAPResponse.<init>(IMAPResponse.java:61)
at com.sun.mail.imap.protocol.IMAPResponse.readResponse(IMAPResponse.java:135)
at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:261)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:114)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:104)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:538)
... 6 more
DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
DEBUG: enable SASL
DEBUG: mail.imap.sasl.authorizationid: user1
If i change the sessionFactory.class or if I remove this property I donot get any Exception It gets Executed well, but IT goes directly to the Adminstrators Mail account but not to the AuthorizationId I gave it. Can any one give me sugssion upon this issue.I don't understand whether the problem was with the Exchange Server I was trying to connect or with my local Environment