===============================================================================================================
String host="xx,x.xx.cx";
final String username="sssssss@bs-shipmanagement.com";
final String password="444444444444";
Authenticator auth=new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username, password);
}
};
Properties props=new Properties();
Session session = Session.getInstance(props,auth);
session.setDebug(true);
Store store = session.getStore("imap");
System.out.println("store------"+store);
store.connect(host,username,password);
System.out.println("Connected...");
Folder inbox = store.getDefaultFolder().getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
Message[] msg = inbox.getMessages();
System.out.println(msg);
inbox.close(false);
store.close();
=========================================================================================================================
DEBUG: setDebug: JavaMail version 1.4.4
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
DEBUG: mail.imap.statuscachetimeout: 1000
DEBUG: mail.imap.appendbuffersize: -1
DEBUG: mail.imap.minidletime: 10
store------imap:
DEBUG: trying to connect to host "xx,x.xx.cx", port 143, isSSL false
* OK The Microsoft
Exchange IMAP4 service is ready.
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 LOGINDISABLED IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
DEBUG: protocolConnect login, host=xx,x.xx.cx, user=sasds@bs-ssmanagement.com, password=<non-null>
javax.mail.MessagingException: No login methods supported!;
nested exception is:
com.sun.mail.iap.ProtocolException: No login methods supported!
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:663)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at BsmMail.main(BsmMail.java:51)
Caused by: com.sun.mail.iap.ProtocolException: No login methods supported!
at com.sun.mail.imap.IMAPStore.login(IMAPStore.java:725)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:643)
... 3 more
===========================================================================================================================