Bitbucket Server throws "Unrecognized SSL message, plaintext connection?" when sending test emails

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

Test emails cannot be sent.

The following appears in the atlassian-bitbucket.log:

1 2 3 4 5 6 WARN [<http_thread>] <username> <session_id> <source_ip> "POST /admin/mail-server HTTP/1.1" c.a.s.i.w.a.MailServerConfigurationController Failed to send a test email message to <email_address> com.atlassian.bitbucket.mail.MailSendException: Mail sending failed. Please verify the mail server configuration and check the logs for details ... Caused by: javax.mail.MessagingException: Could not connect to SMTP host: <hostname>, port: 587 ... Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

Cause

Bitbucket Server is attempting to connect to the mail server via SSL while the mail server is not configured with SSL.

Resolution

  • Go to the administration area and click Mail server (under 'Settings')

  • Select "SMTP" as protocol

  • Make sure that "587" or "25" is set as port. Port 465 was previously used for Secure SMTP (SMTPS), but it has now been deprecated.

Updated on April 11, 2025

Still need help?

The Atlassian Community is here for you.