Skip to content

Commit

Permalink
fixed issue with missing IMAP properties for Office 365
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 5, 2024
1 parent d9709bc commit 146fe76
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,20 @@ public PasswordAuthentication getPasswordAuthentication() {

Store store = null;
if (ms.isMsExchange()) {
imapProps.put("mail.imaps.sasl.enable", "true");
imapProps.put("mail.imaps.port", "993");

imapProps.put("mail.imaps.auth.mechanisms", "XOAUTH2");
imapProps.put("mail.imaps.sasl.mechanisms", "XOAUTH2");

imapProps.put("mail.imaps.auth.login.disable", "true");
imapProps.put("mail.imaps.auth.plain.disable", "true");

imapProps.setProperty("mail.imaps.socketFactory.class", SSL_FACTORY);
imapProps.setProperty("mail.imaps.socketFactory.fallback", "false");
imapProps.setProperty("mail.imaps.socketFactory.port", "993");
imapProps.setProperty("mail.imaps.starttls.enable", "true");

String authToken = MsExchangeUtils.getAuthToken(ms.getTenantId(), ms.getClientId(), ms.getClientSecret(), ms.getEmailInUser(), inPwd);

session = Session.getInstance(imapProps);
Expand Down

0 comments on commit 146fe76

Please sign in to comment.