Here i want to make a imap secure connection but i am facing a problem. Java mail Api allows to create a connection with wrong userid or password. Here is my code
Properties prop = new Properties();
String protocol="imap";
String host="imap.gmail.com";
int port=993;
String userName="";
String password="";
prop.put("mail.host",host);
prop.put("mail.imap.socketFactory.class", SSL_FACTORY);
prop.put("mail.imap.socketFactory.fallback", "false");
prop.put("mail.imap.sasl.enable","true");
prop.put("mail.imap.auth.login.disable","true");
prop.put("mail.imap.timeout","10000");
Session session = Session.getInstance(prop);
Store _store = session.getStore(protocol);
try {
_store.connect(host,port, userName, password);
}catch (MessagingException e) {
}
Here _store.conect allows to make connection with wrong user id and password and do not throw any authentication related exception. Please help me to resolve this problem.