Mail sending failed - sign-in attempt prevented
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
When configuring the mail server for use with a Google Gmail account that doesn't use 2-step authentication, several things occur:
You see the following message in the Bitbucket Server UI:
Mail sending failed. Please verify the mail server configuration and check logs for details.
The following appears in the
atlassian-bitbucket-mail
.log:
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
- 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
- Log in with your Gmail account.
- Find "Allow less secure apps" here.
- Turn on "Allow less secure apps".