Gitlab CE Docker container sending mail with remote relay

Hi all, I have installed the latest Gitlab CE with Docker using the following docker-compose file (the two lines marked with a ‘#’ are lines I have tried with and without but neither way sees success):

image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: always
hostname: gitlab
external_url ‘
gitlab_rails[‘gitlab_shell_ssh_port’] = 10022
gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = ‘’
gitlab_rails[‘smtp_port’] = ‘587’
gitlab_rails[‘smtp_domain’] = ‘
#gitlab_rails[‘smtp_authentication’] = false
#gitlab_rails[‘smtp_tls’] = false
gitlab_rails[‘gitlab_email_from’] = ‘’
gitlab_rails[‘gitlab_email_reply_to’] = ‘’
- ‘10022:22’
- ‘/docker/gitlab/config:/etc/gitlab’
- ‘/docker/gitlab/logs:/var/log/gitlab’
- ‘/docker/gitlab/data:/var/opt/gitlab’

With the above configuration, when I go into the gitlab-rails console inside the docker container to send a test email using the following:

Notify.test_email(‘’, ‘Message Subject’, ‘Message Body’).deliver_now

I get the following error:

Delivered mail 6435c45e40b07_71e4920132eb@gitlab.mail (13.6ms)
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:46:in `connect_nonblock’: SSL_connect returned=1 errno=0 state=error: certificate verify failed (Hostname mismatch) (OpenSSL::SSL::SSLError)

As far as I can tell, this error seems to be happening on the gitlab side, although I could be mistaken. I’m not clear on exactly where the error is occurring in the connection process so I wanted to reach out to see.

The relay server should automatically accept the mail from the IP address of this docker container/host. It functions with other sources forwarding mail to it without authentication. Is there a config issue on the gitlab side I am missing or is the problem something I haven’t considered in the tls communication with the relay server?

Thanks for any thoughts!

I was able to solve this. I’ll leave it posted in case anyone ever runs into the same issue.
I needed to put the FQDN of the relay server for smtp_address, not just the IP