Mail sending failed - sign-in attempt prevented

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

When configuring the mail server for use with a Google Gmail account that doesn't use 2-step authentication, several things occur:

  1. You see the following message in the Bitbucket Server UI:

    Mail sending failed. Please verify the mail server configuration and check logs for details.

  2. The following appears in the atlassian-bitbucket-mail.log:

    1 org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
  3. Gmail sends an email stating that the sign-in attempt was prevented

Cause

Since 2-step authentication is not being used, Gmail prevents this less secure method of authentication.

Resolution

  1. Log in with your Gmail account.

  2. Find "Allow less secure apps" here.

  3. Turn on "Allow less secure apps".

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.