Configure GitLab to send emails using Gmail SMTP settings

If you are planning to send application emails via gmail SMTP server intead of via Sendmail, follow the steps below

Open GitLab config file in an editor

sudo vim /etc/gitlab/gitlab.rb

Add the following line in the config file

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "my.email@gmail.com"
gitlab_rails['smtp_password'] = "my-gmail-password"
gitlab_rails['smtp_domain'] = "smtp.gmail.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

Change “my.email@gmail.com” with your email address and “my-gmail-password” with your email password.

If you are using gsuite and planning to use your gsuite email address, change the shtp domain to your domain name.

Save the file and reconfigure GitLab for the changes to take effect.

sudo gitlab-ctl reconfigure

Your GitLab server must be able to send emails now!!

Post navigation

Alvin Jaison

Myself Alvin Jaison. I'm a DevOps Engineer by Profession; A Mountaineer by Passion. I started this website to share DevOps related posts. Post your suggestions as a comment. You can reach me @ alvinjaison@outlook.com

Leave a Reply

Your email address will not be published. Required fields are marked *