Confluence throws 'Error connecting to mail server: Command is not valid in this state' when connecting to Office 365
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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.