Outlook
A family of Microsoft email and calendar products.
4,504 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
am having a test outlook email which doesn't have any active subscription for Azure Active Directory.
I have registered my application. in Azure Active Directory and started reding the test email message in java code base using javax.mail library.
but what happening always am getting Authentication Failed exception does it needs the active subscription.
Code base am using.
Properties props = new Properties();
props.put("mail.imaps.sasl.enable", "true");
props.put("mail.imaps.sasl.mechanisms", "XOAUTH2");
props.put("mail.imaps.sasl.mechanisms.oauth2.oauthToken", "accessToken");
Session session = Session.getInstance(props);
IMAPStore store = new IMAPStore(session, null);
try {
store.connect("outlook.office365.com", 993, "AccessToken", "");
} catch (MessagingException e) {
throw e;
}
A1 NO AUTHENTICATE failed.
Exception in thread "main" javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732)
at javax.mail.Service.connect(Service.java:366)
at javax.mail.Service.connect(Service.java:246)
at com.oauth.sample.ConnectOutEmailByPassingAccessToken.main(ConnectOutEmailByPassingAccessToken.java:52)