GitLab does not send emails

I have installed GitLab CE on AWS. Everything is working except that the mails aren’t being sent.

I’ve installed it using the community AMI for GitLab CE 9.2.1 on an Ubuntu instance.
Postfix is also installed and configured correctly. I can successfully send emails on the console using sendmail command.

I can also successfully send notification mails using GitLab-Rails console:

irb(main):003:0> Notify.test_email('destination_email@address.com', 
  'Message Subject', 'Message Body').deliver_now

However, if I use the password-reset-form or for example add a user to a project, the mails won’t be sent.

No postfix log will be written, which means it doesn’t even try to send the email using postfix.

On the administration area, under Monitoring -> Background Jobs, I can see that the jobs to send the mails are marked as dead, with the following error message:

17 minutes ago	mailers	DeviseMailer#reset_password_instructions	
{"_aj_globalid"=>"gid://gitlab/User/4"}, "T7AE4dRSJzcKm7pVTDM1", 
{"_aj_symbol_keys"=>[]} Net::OpenTimeout: execution expired

Would someone help me to debug this? I have already look all the logs I know and cannot figure it out why :frowning:

Thanks in advance,
Elin

I’ve exactly the same problem since I’ve updated my box to Gitlab CE 9.3.1. I can send mails from the GitLab Rails console but Gitlab itself always fails to send mails with the following error showing up in sidekiq.log:

2017-06-28_12:33:05.66511 2017-06-28T12:33:05.665Z 19417 TID-oxcu4690c WARN: Net::OpenTimeout: execution expired
2017-06-28_12:33:05.66511 2017-06-28T12:33:05.665Z 19417 TID-oxcu4690c WARN: /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:880:in `initialize'
2017-06-28_12:33:05.66511 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:880:in `open'
2017-06-28_12:33:05.66511 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:880:in `block in connect'
2017-06-28_12:33:05.66512 /opt/gitlab/embedded/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
2017-06-28_12:33:05.66512 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:878:in `connect'
2017-06-28_12:33:05.66512 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
2017-06-28_12:33:05.66512 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:852:in `start'
2017-06-28_12:33:05.66512 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:584:in `start'
2017-06-28_12:33:05.66513 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:479:in `get_response'
2017-06-28_12:33:05.66513 /opt/gitlab/embedded/lib/ruby/2.3.0/net/http.rb:456:in `get'
2017-06-28_12:33:05.66513 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_loaders/network_loader.rb:9:in `load'
2017-06-28_12:33:05.66513 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:37:in `block in load_css'
2017-06-28_12:33:05.66514 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:36:in `each'
2017-06-28_12:33:05.66514 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:36:in `load_css'
2017-06-28_12:33:05.66514 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:21:in `css_for_url'
2017-06-28_12:33:05.66514 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:17:in `block in css_for_doc'
2017-06-28_12:33:05.66515 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:17:in `map'
2017-06-28_12:33:05.66515 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/css_helper.rb:17:in `css_for_doc'
2017-06-28_12:33:05.66515 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/customized_premailer.rb:14:in `initialize'
2017-06-28_12:33:05.66515 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/hook.rb:87:in `new'
2017-06-28_12:33:05.66516 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/hook.rb:87:in `premailer'
2017-06-28_12:33:05.66516 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/hook.rb:76:in `generate_html_part'
2017-06-28_12:33:05.66516 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/hook.rb:52:in `generate_html_part_replacement'
2017-06-28_12:33:05.66517 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/hook.rb:24:in `perform'
2017-06-28_12:33:05.66517 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/premailer-rails-1.9.2/lib/premailer/rails/hook.rb:8:in `perform'
2017-06-28_12:33:05.66517 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/mail.rb:243:in `block in inform_interceptors'
2017-06-28_12:33:05.66517 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/mail.rb:242:in `each'
2017-06-28_12:33:05.66518 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/mail.rb:242:in `inform_interceptors'
2017-06-28_12:33:05.66518 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:225:in `inform_interceptors'
2017-06-28_12:33:05.66518 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:235:in `deliver'
2017-06-28_12:33:05.66518 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
2017-06-28_12:33:05.66519 /opt/gitlab/embedded/service/gitlab-rails/app/workers/emails_on_push_worker.rb:89:in `send_email'
2017-06-28_12:33:05.66519 /opt/gitlab/embedded/service/gitlab-rails/app/workers/emails_on_push_worker.rb:55:in `block in perform'
2017-06-28_12:33:05.66519 /opt/gitlab/embedded/service/gitlab-rails/app/workers/emails_on_push_worker.rb:53:in `each'
2017-06-28_12:33:05.66519 /opt/gitlab/embedded/service/gitlab-rails/app/workers/emails_on_push_worker.rb:53:in `perform'
2017-06-28_12:33:05.66519 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:204:in `execute_job'
2017-06-28_12:33:05.66520 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:175:in `block (2 levels) in process'
2017-06-28_12:33:05.66520 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
2017-06-28_12:33:05.66520 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_status/server_middleware.rb:5:in `call'
2017-06-28_12:33:05.66521 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-06-28_12:33:05.66521 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/request_store_middleware.rb:6:in `call'
2017-06-28_12:33:05.66521 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-06-28_12:33:05.66521 /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/sidekiq_middleware/memory_killer.rb:17:in `call'
2017-06-28_12:33:05.66521 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-06-28_12:33:05.66522 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/server/active_record.rb:15:in `call'
2017-06-28_12:33:05.66522 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-06-28_12:33:05.66522 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sentry-raven-2.4.0/lib/raven/integrations/sidekiq.rb:7:in `call'
2017-06-28_12:33:05.66522 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:130:in `block in invoke'
2017-06-28_12:33:05.66523 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/middleware/chain.rb:133:in `invoke'
2017-06-28_12:33:05.66523 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:174:in `block in process'
2017-06-28_12:33:05.66523 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:146:in `block (6 levels) in dispatch'
2017-06-28_12:33:05.66523 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/job_retry.rb:97:in `local'
2017-06-28_12:33:05.66524 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:145:in `block (5 levels) in dispatch'
2017-06-28_12:33:05.66524 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq.rb:36:in `block in <module:Sidekiq>'
2017-06-28_12:33:05.66524 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:141:in `block (4 levels) in dispatch'
2017-06-28_12:33:05.66525 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:220:in `stats'
2017-06-28_12:33:05.66525 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:136:in `block (3 levels) in dispatch'
2017-06-28_12:33:05.66525 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/job_logger.rb:8:in `call'
2017-06-28_12:33:05.66525 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:135:in `block (2 levels) in dispatch'
2017-06-28_12:33:05.66526 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/job_retry.rb:72:in `global'
2017-06-28_12:33:05.66526 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:134:in `block in dispatch'
2017-06-28_12:33:05.66526 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/logging.rb:32:in `with_context'
2017-06-28_12:33:05.66526 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:133:in `dispatch'
2017-06-28_12:33:05.66526 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:173:in `process'
2017-06-28_12:33:05.66527 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:85:in `process_one'
2017-06-28_12:33:05.66527 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/processor.rb:73:in `run'
2017-06-28_12:33:05.66527 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/util.rb:17:in `watchdog'
2017-06-28_12:33:05.66527 /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/sidekiq-5.0.0/lib/sidekiq/util.rb:26:in `block in safe_thread'

Any ideas what might go wrong? Help is very much appreciated.

Updating to newest Gitlab CE Version 9.3.3 fixed the problem.

Fixed with CE version 9.3.4
Thanks