JavaMail POP3 over SSL Connect failed (Office365); AuthenticationFailedException: Logon failure: unknown user name and bad password

Viewed 61

I would like to download mail attachment by accessing the POP3 server SSL(Office365) is configured on the local environment, but it seem failed to connect.

FailedException:

AuthenticationFailedException: Logon failure: unknown user name and bad password.

enter image description here

But we confirmed that the email and password is correct.

Setting:

// ready to connect server
Properties props = new Properties();
props.setProperty("mail.store.protocol", "pop3");
props.setProperty("mail.pop3.port", port);
props.setProperty("mail.pop3.host", host);

props.setProperty("mail.pop3.socketFactory.fallback", "false");
props.setProperty("mail.pop3.socketFactory.port", port);
props.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");

// create session
Session session = Session.getInstance(props);

store = session.getStore("pop3");
store.connect(emailAddress, password);

// retrieve
folder = store.getFolder("INBOX");
//inbox
folder.open(Folder.READ_WRITE);

What do I missed? It was working before

0 Answers
Related