Invitation Emails won't send

Problem to solve

If I add invitation to a new user, EMail doesn’t received.

If I have a look on CLI with “mailq” or “postqueue -p” I see the deferred Emails, as the stay in the spool forever.

If I check /var/log/mail.log, I see error messages like:

postfix/smtp[6377]: connect to mail.halbe.com[178,210,125,66]:25: Connection timed out

I see that message for each invitation-mail which is pending in the spool, even if it’s on any other servers (like gmail.com, gmx.net etc.)

If I do a ping to the mail.halbe.com (or to their IP) from the CLI of the Gitlab-Server, it succeed

Configuration

/etc/gitlab/gitlab.rb smtp section looks like this:

gitlab_rails [‘smtp_enable’] = true
gitlab_rails [‘smtp_address’] = “mail01.xyz.com”
gitlab_rails [‘smtp_port’] = 587
gitlab_rails [‘smtp_user_name’] = “user@my-domain.net”
gitlab_rails [‘smtp_password’] = “mypassword”
gitlab_rails [‘smtp_domain’] = “mail01.xyz.com”
gitlab_rails [‘smtp_authentication’] = “plain”
gitlab_rails [‘smtp_enable_starttls_auto’] = true
gitlab_rails [‘smtp_tls’] = false
gitlab_rails [‘gitlab_email_enabled’] = ‘true’

gitlab_rails['gitlab_email_from'] = "user@my-domain.net"
gitlab_rails['gitlab_email_display_name'] = "gitlab-server"
gitlab_rails['gitlab_email_reply_to'] = "noreply@my-domain.net"

Versions

Please select whether options apply, and add the version information.

Versions

  • GitLab GitLab Community Edition v16.9.1

I wonder if Gitlab really try to send the Emails via external SMTP, as I can find the invitation-mails in my local spool-server.
Shouldn’t they be delivered to the gitlab-server I’ve set up in the gitlab.rb, so that the logs on this server should appear?

Solved it now.
Come back here to give some solution for other ones who might have the same issue.

Analyze

At least the main battle was to get to know, why exactly no Email was sent, or which error might occur during sending an email.

Dashing from Discord-Server “GitLab Community” helped me a lot with this. Big Thank you, to you Dashing!

If you change something in the /etc/gitlab/gitlab.rb make sure to

  1. run gitlab-ctl reconfigure
  2. run gitlab-ctl restart

If it’s don’t work yet, start the Rails-console and try to send an test-email. Then you can see the response of the execution immediately:

sudo gitlab-rails console   (wait for it, can take a minute or two, to load!!!)

If irb>-Prompt appears, type in following:

Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now 

For me at least the issue was the type of Authentication, used Port and choosed SSL-Settings.
But that may be a different setting for each Email-Provider, so you have to figure this out for yourself and adjust it.

Hope this helps somebody.

1 Like