Office 365 SMTP Configuration throws 'Unrecognized SSL message' error and fails in Crowd

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

Attempting to configuring a SMTP connection in Crowd to Office 365 fails.

The following appears in the Crowd logs:

1 java.lang.RuntimeException: Could not send email to <email-address>: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

Cause

The built in SMTP configuration screen for Crowd does not work with Office 365.

Workaround

  1. Stop Crowd

  2. Move activation-1.1.1.jar from <crowd-install>/crowd-webapp/WEB-INF/lib to <crowd-install>/apache-tomcat/lib

  3. Add the following to <crowd-install>/apache-tomcat/conf/Catalina/localhost/crowd.xml before the </Context>:

    1 2 3 4 5 6 7 8 9 10 11 <Resource name="mail/Office365" auth="Container" type="javax.mail.Session" mail.smtp.host="smtp.office365.com" mail.smtp.port="587" mail.smtp.auth="true" mail.smtp.user="yourEmailAddress@yourOffice365.com" password="yourPassword" mail.smtp.starttls.enable="true" mail.transport.protocol="smtps" />
  4. Start Crowd

  5. Configure the SMTP mail server to use the JNDI location of java:comp/env/mail/Office365

  6. Save and send a test email

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.