Exchange Connection Problems

Fix Outlook Office 365 IMAP Authentication Failure in JavaMail

Bushra ParveenBushra Parveen Nov 22, 2026 868 views

Question details

Connect a JavaMail application to an Office 365 mailbox using IMAP.

Fix Outlook Office 365 IMAP Authentication Failure in JavaMail
Product
Exchange Online IMAP and JavaMail
Device & OS
not provided
Scenario
A Java application connects to outlook.office365.com to access an Office 365 mailbox.
Observed behavior
The server responds to the CAPABILITY command, but authentication with AUTHENTICATE PLAIN fails.
Before you start

Confirm the mailbox address and check whether the application uses a password or an OAuth 2.0 access token. Have an Exchange administrator available to verify mailbox access and app permissions if needed.

Solution 1Recommended

Check the Office 365 IMAP connection settings

Use these settings to rule out an incorrect server, port, or encryption method.

1
Set the incoming server

In the JavaMail connection settings, set the IMAP host to outlook.office365.com and the port to 993. Use an implicit TLS connection, such as the imaps protocol.

2
Check the mailbox address

Set the username in the application's account configuration to the full Office 365 mailbox address and check it for typing errors.

3
Check SMTP if used

If the application also sends mail, configure smtp.office365.com on port 587 with STARTTLS. This setting does not control IMAP authentication.

4
Test the account in Outlook

Add the account in Outlook through File > Add Account and sign in. A successful sign-in helps determine whether the issue is specific to the Java application.

Check the Office 365 IMAP connection settings
TLS and SSL labels: Some clients label implicit TLS on port 993 as SSL/TLS. The label alone does not mean the encryption setting is wrong.
Free Microsoft Office alternative

Work with Office documents in WPS Office

WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format support help you move existing files smoothly. It does not fix Exchange Online IMAP authentication.

Open and edit Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXUse a familiar interface for everyday Office document tasksWork with exported mail-related documents and spreadsheetsUse a lightweight Office suite with free tools
microsoft office alternative - wps office

Frequently Asked Questions

Why does IMAP CAPABILITY work but authentication fail?

CAPABILITY only shows that the application reached the server and received its capabilities. Authentication can still fail because of the chosen method, token, permissions, or mailbox settings.

Can I use my Office 365 password with AUTHENTICATE PLAIN?

Exchange Online no longer supports Basic authentication for IMAP. Configure your application to use OAuth 2.0 and the XOAUTH2 mechanism instead.

Which port and encryption should I use for Office 365 IMAP?

Connect to outlook.office365.com on port 993 using implicit TLS. Depending on the client, this may be labeled SSL/TLS.

Where can an administrator check whether IMAP is enabled?

In the Microsoft 365 admin center, go to Users > Active users, select the user, and open Mail > Manage email apps to check IMAP access.