GitLab Omnibus sendmail not working

GitLab sendmail Omnibus email not working after installation complete

Based off the GitLab documentation and the configuration file gitlab.rb, I should be able to edit the email settings section of the file to get email working. I added the Pipeline Email integration for my project so after each successful pipeline, emails will be sent to the emails I listed. It isn’t clear after reading the docs whether I need additional configuration (besides uncommenting the config file) to get sendmail to work.

Here is my config settings:

 ### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab.admin@mydomain.org'
gitlab_rails['gitlab_email_display_name'] = 'Jon - Admin'
gitlab_rails['gitlab_email_reply_to'] = 'gitlab.admin@mydomain.org'
gitlab_rails['gitlab_email_subject_suffix'] = ''# gitlab_rails['gitlab_email_smime_enabled'] = false
# gitlab_rails['gitlab_email_smime_key_file'] = '/etc/gitlab/ssl/gitlab_smime.key'
# gitlab_rails['gitlab_email_smime_cert_file'] = '/etc/gitlab/ssl/gitlab_smime.crt'

After testing the sendmail command in the console:

Notify.test_email('emmy27@ethereal.email', 'Message Subject', 'Message Body').deliver_now

This is the output:

Loading production environment (Rails 6.0.2)
irb(main):001:0> Notify.test_email('emmy27@ethereal.email', 'Message Subject', 'Message Body').deliver_now
Notify#test_email: processed outbound mail in 1.3ms
sh: 1: /usr/sbin/sendmail: not found
Delivered mail 5eab3509623a5_24733fc442dd39989919@f005bd7df009.mail (4.9ms)
Date: Thu, 30 Apr 2020 20:28:57 +0000
From: Jon - Admin <gitlab.admin@mydomain.org>
Reply-To: Jon- Admin <gitlab.admin@mydomain.org>
To: emmy27@ethereal.email
Message-ID: <5eab3509623a5_24733fc442dd39989919@f005bd7df009.mail>
Subject: Message Subject
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>Message Body</p></body></html>

=> #<Mail::Message:70111751015620, Multipart: false, Headers: <Date: Thu, 30 Apr 2020 20:28:57 +0000>, <From: Jon - Admin <gitlab.admin@mydomain.org>>, <Reply-To: Jon 
- Admin <gitlab.admin@mydomain.org>>, <To: emmy27@ethereal.email>, <Message-ID: <5eab3509623a5_24733fc442dd39989919@f005bd7df009.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):002:0> 

My GitLab version

GitLab: 12.9.2-ee (0ad76f4d374) EE
GitLab Shell: 12.0.0
PostgreSQL: 10.12

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Your error seems to suggest you don’t have sendmail installed. As a test do # which sendmail from a terminal and see if it is installed. You may find postfix is installed instead.

1 Like

I’m using the docker CE version and I have the same problem.
I can see “sendmail” is missing so emails are never sent.

I tried to go into a shell in the container and install “sendmail”
( had to use this trick as well https://askubuntu.com/questions/937666/ubuntu-16-04-command-line-sendmail-installation-hanged since “apt-get install -y sendmail” hangs )

Aaaanyway, even after all that, emails were not sent to new users.
I try restarting my docker stack, only to realise that the new container is missing sendmail again, so back to square one.

I’m curious, how isn’t that problem more common?
Do other people not use emails to private invitations?
Or do they set up gmail or something else via SMTP?

Thank you.