How can I debug e-mail sending on Gitlab?

Maybe try enabling delivery errors in production mode and see what happens

  config.action_mailer.raise_delivery_errors = true

First, I will tell what was my problem: The sidekiq is responsible for handling sending e-mails. For some reason my sidekiq was stuck, restarting it solved the problem.

Where I found information about problems I found on Gitlab:

  1. The logs dir. It has a few informations.
  2. On admin page, the section "Background jobs" gives information about the sidekiq.
  3. The javascript console (if your browser supports it) also has useful information. Only if your problem is related to javascript.
  4. And if you reach this point, you may modify Gitlab's code so you can "trace it" writing to a file:

    File.open('/tmp/logfile','a') { |file| file.write("Hello World!\n") }


Stumbled upon this issue today, here's my research:

Debugging SMTP connections in the GitLab GUI is not supported yet. However there is a pending feature request and a command line solution.

Set the desired SMTP settings /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure (see https://docs.gitlab.com/omnibus/settings/smtp.html).

Start the console running gitlab-rails console -e production.

Show the configured delivery method (should be :smtp) running the command ActionMailer::Base.delivery_method. Show all configured SMTP settings running ActionMailer::Base.smtp_settings.

To send a test mail run

Notify.test_email('[email protected]', 'Hello World', 'This is a test message').deliver_now

On the admin page in GitLab, the section »Background jobs« shows information about all jobs. Failing SMTP connections are listed there as well.

Please note, you may need to restart the GitLab instance in order to use the newly configured SMTP settings (on my instance the console was able to send mails, the GUI required a restart). Run gitlab-ctl restart to restart your instance.


I had the same problem and found that I needed to mod application.rb:

diff --git a/config/application.rb b/config/application.rb
index d85bcab..274976f 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -11,6 +11,8 @@ end

 module Gitlab
   class Application < Rails::Application
+    config.action_mailer.sendmail_settings = { :arguments => "-i" }
+
     # Settings in config/environments/* take precedence over those specified here.
     # Application configuration should go into files in config/initializers
     # -- all .rb files in that directory are automatically loaded.

Note: I'm running Debian 7 which uses exim for mail.