Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Problem with making imap secure connection

2980481Nov 23 2015

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.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 21 2015
Added on Nov 23 2015
0 comments
751 views