Hello all,
I followed this documentation to configure Bitbucket to use gmail as a mailserver, but I get the error "Sending mail failed. Please verify the mail server configuration and check the logs for details".
Bellow you can find a screenshot from the settings:
Hello!
To get started, have you reviewed the atlassian-bitbucket-mail<strong><em>.log</em></strong> for any errors from your attempt to connect? This will be located in your "<em><strong>$BITBUCKET_HOME/log</strong></em>"
<strong><em>.log</em></strong> for any errors from your attempt to connect? This will be located in your "<em><strong>$BITBUCKET_HOME/log</strong></em>"
Since you are connecting to gmail, have you received any email from Google for your failed login attempt?
We do have a KB article available regarding <a href="https://confluence.atlassian.com/bitbucketserverkb/mail-sending-failed-sign-in-attempt-prevented-815593009.html" target="_blank" rel="nofollow noopener noreferrer">rejected sign-in attempts</a> with gmail that you can review to see if it applies to your situation.
-Mark
Hello,
thank you for the reply. I do not receiving any rejected sign-in errors. It seems that it cannot connect to the server. Bellow you will find the atlassian-bitbucket-mail.log messages when using ports 465 and 587.
For 465:
ERROR [https-jsse-nio-7443-exec-4] admin @R1DE1Zx722x105x0 7lq14l 84.205.241.5 "POST /admin/mail-server HTTP/1.1" bitbucket.mail-log Sending mail failed. Please verify the mail server configuration and check the logs for details; recipient: pliago@hotmail.com; subject: Bitbucket - Test email for your SMTP configurationorg.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.........Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
For 587:
ERROR [https-jsse-nio-7443-exec-6] admin @R1DE1Zx723x125x0 7lq14l 84.205.241.5 "POST /admin/mail-server HTTP/1.1" bitbucket.mail-log Sending mail failed. Please verify the mail server configuration and check the logs for details; recipient: pliago@hotmail.com; subject: Bitbucket - Test email for your SMTP configurationorg.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not convert socket to TLS;............Caused by: javax.mail.MessagingException: Could not convert socket to TLS...Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Thanks for the output.
Did you try the steps outlined in the KB article I linked?
- failed sign-in
In the above, you allow less secured apps to connect.
If you have tried the above KB and it fails with the same message, I would attempt to verify that you can actually connect to that port from Bitbucket Server itself by executing one of the following commands:
telnet smtp.gmail.com 465
telnet smtp.gmail.com 587
If it does not connect, then it means that your network is not allowing communication over that port in which I would turn investigation there to ensure firewalls or other routing isn't blocking your request.
The Allow less secure apps option is enabled on my google account and I can connect through telnet to the smtp server.
I had the same problem with Crowd and was resolved by using JNDI (Here is the question I asked: Crowd cannot communicate with mail server)).
However I cannot seem to find the JNDI option in Bitbucket
Thanks for the confirmation.
Unfortunately, JNDI configuration is not possible with Bitbucket Server. In my investigation, I found another KB regarding failed mail server configuration with gmail and it states:
Port 465 shows up in Appendix A of the 1996 non-standard The SSL Protocol Version 3.0 as "Simple Mail Transfer Protocol with SSL". Unfortunately, it's not registered for SMTPs. It's registered for URD - "URL Rendezvous Directory for SSL" by Cisco. The recommended approach, at least for authentication, is to use STARTTLS encryption on port 587.Port 25 can be used but it is for server to relay messages to one another. Port 587 is recommended because this way ISPs can block outgoing SMTP on their networks but still allow users to send email to another mail server.
Port 465 shows up in Appendix A of the 1996 non-standard The SSL Protocol Version 3.0 as "Simple Mail Transfer Protocol with SSL". Unfortunately, it's not registered for SMTPs. It's registered for URD - "URL Rendezvous Directory for SSL" by Cisco. The recommended approach, at least for authentication, is to use STARTTLS encryption on port 587.
Port 25 can be used but it is for server to relay messages to one another. Port 587 is recommended because this way ISPs can block outgoing SMTP on their networks but still allow users to send email to another mail server.
With this, let's stick with port 587 which gives a different error:
Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
I could not reproduce your issue on port 587 but if we were to look at the error, it would indicate that your certificate truststore couldn't be found, was empty, or could not be opened due to permissions. Can you investigate your truststore configuration?
Same Problem
It looks like you're new here. Sign in or register to get started.