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):

services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: always
hostname: gitlab
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘http://gitlab.example.com
gitlab_rails[‘gitlab_shell_ssh_port’] = 10022
gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = ‘10.0.0.25’
gitlab_rails[‘smtp_port’] = ‘587’
gitlab_rails[‘smtp_domain’] = ‘example.com
#gitlab_rails[‘smtp_authentication’] = false
#gitlab_rails[‘smtp_tls’] = false
gitlab_rails[‘gitlab_email_from’] = ‘noreply-gitlab@example.com’
gitlab_rails[‘gitlab_email_reply_to’] = ‘me@example.com’
ports:
- ‘10022:22’
volumes:
- ‘/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(‘me@example.com’, ‘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

Thanks!