Confluence throws 'Error connecting to mail server: Command is not valid in this state' when connecting to Office 365

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Confluence is unable to receive emails from Office 365 and throws the error 'Error connecting to mail server: Command is not valid in this state.'.

Cause

Confluence is not being able to connect to the mail server using a non-SSL connection. SSL is required by Office 365.

Resolution

To connect over SSL, select POPS in the 'Protocol' drop-down. Use the following configuration options for connecting to Office 365 for mail retrieval:

Server Name

Port

Requires SSL (TLS)

outlook.office365.com

995

Yes

See POP and IMAP settings for Outlook Office 365 for business for additional details on the required POP/IMAP settings for Outlook Office 365.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.