Updated 2026-11-20
How to Configure SMTP for Self-Managed GitLab
In /etc/gitlab/gitlab.rb set gitlab_rails['smtp_enable'] = true, smtp_address "smtp.bulko.io", smtp_port 587, your Bulko SMTP username and password, smtp_authentication "login", smtp_enable_starttls_auto true and smtp_tls false, plus gitlab_email_from on your own domain. Run sudo gitlab-ctl reconfigure and send a test with Notify.test_email(...).deliver_now in gitlab-rails console.
GitLab has no SMTP form in the Admin Area: outgoing mail is configured in files. On a Linux package (Omnibus) install that means the gitlab_rails['smtp_*'] keys in /etc/gitlab/gitlab.rb, in Docker the same keys passed through GITLAB_OMNIBUS_CONFIG, and in Kubernetes the Helm chart's global.smtp values.
GitLab sends a lot of mail people actually wait for: account confirmation and password reset links, two-factor and sign-in notifications, issue and merge request notifications, pipeline failure alerts, and invitations. Without SMTP the Linux package falls back to Sendmail/Postfix on the host, and the Docker image has no mail server at all, so these messages either never leave the box or arrive from an unauthenticated server and land in spam.
This guide is for self-managed GitLab only. On GitLab.com (SaaS) the outgoing mail server is run by GitLab and cannot be changed.
GitLab SMTP settings
| Field | Value |
|---|---|
| gitlab_rails['smtp_enable'] | true |
| gitlab_rails['smtp_address'] | "smtp.bulko.io" |
| gitlab_rails['smtp_port'] | 587 (or 2525; 465 only with smtp_tls = true) |
| gitlab_rails['smtp_user_name'] | Your Bulko SMTP username (smtp_xxxxxxxxxxxxxxxx) |
| gitlab_rails['smtp_password'] | Your Bulko SMTP password (or store it encrypted, see below) |
| gitlab_rails['smtp_authentication'] | "login" ("plain" also works) |
| gitlab_rails['smtp_enable_starttls_auto'] | true for 587/2525, false for 465 |
| gitlab_rails['smtp_tls'] | false for 587/2525, true for 465 |
| gitlab_rails['smtp_openssl_verify_mode'] | 'peer' (public certificate, no smtp_ca_file needed) |
| gitlab_rails['gitlab_email_from'] | An address on a domain you control, e.g. [email protected] |
Step-by-step setup
- Buy an SMTP package on the Bulko SMTP Relay page and copy the username and password from Dashboard -> SMTP Access. Optionally verify your sending domain under Sending domains so GitLab mail is DKIM-signed with your domain.
- On the GitLab server, open
/etc/gitlab/gitlab.rbas root and find the commented SMTP block (it starts with Use smtp instead of sendmail/postfix). - Uncomment and set
smtp_enable,smtp_address,smtp_port,smtp_user_name,smtp_password,smtp_authenticationandsmtp_domainas in the example below. - For port 587 set
smtp_enable_starttls_auto = trueandsmtp_tls = false. Never set both totrue. - Change
gitlab_email_fromfrom the defaultgitlab@<your GitLab hostname>to an address on your domain, and optionally setgitlab_email_display_nameandgitlab_email_reply_to. - Apply the change with
sudo gitlab-ctl reconfigure. If Sidekiq runs on a separate node, put the same SMTP block in itsgitlab.rband reconfigure it too. - Send a test email from
gitlab-rails console(see below) and then trigger a real notification, for example a password reset.
/etc/gitlab/gitlab.rb (Linux package)
# /etc/gitlab/gitlab.rb (excerpt), then: sudo gitlab-ctl reconfigure
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.bulko.io"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "smtp_xxxxxxxxxxxxxxxx"
gitlab_rails['smtp_password'] = "YOUR_BULKO_SMTP_PASSWORD"
gitlab_rails['smtp_domain'] = "gitlab.example.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'
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_display_name'] = 'GitLab'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
# Port 465 instead of 587:
# gitlab_rails['smtp_port'] = 465
# gitlab_rails['smtp_tls'] = true
# gitlab_rails['smtp_enable_starttls_auto'] = false
GitLab in Docker: GITLAB_OMNIBUS_CONFIG
The official gitlab/gitlab-ee and gitlab/gitlab-ce images contain the Linux package but no mail server, so SMTP is the only practical way to send mail from a container. You can either edit /etc/gitlab/gitlab.rb inside the container (docker exec -it gitlab editor /etc/gitlab/gitlab.rb, then docker restart gitlab; the container reconfigures on every start), or pass the settings through GITLAB_OMNIBUS_CONFIG:
services:
gitlab:
image: gitlab/gitlab-ce:latest
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = 'smtp.bulko.io'
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = 'smtp_xxxxxxxxxxxxxxxx'
gitlab_rails['smtp_password'] = 'YOUR_BULKO_SMTP_PASSWORD'
gitlab_rails['smtp_authentication'] = 'login'
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['gitlab_email_from'] = '[email protected]'Two things to know: the variable is evaluated before gitlab.rb and is not written into it, so it must be present on every start; and anyone who can run docker inspect sees the password. Test with docker exec -it gitlab gitlab-rails console.
GitLab Helm chart (Kubernetes): global.smtp
The cloud-native chart does not read gitlab.rb. Store the password in a Kubernetes Secret and point global.smtp at it:
kubectl create secret generic smtp-password --from-literal=password=YOUR_BULKO_SMTP_PASSWORDglobal:
email:
from: [email protected]
display_name: GitLab
reply_to: [email protected]
smtp:
enabled: true
address: smtp.bulko.io
port: 587
user_name: smtp_xxxxxxxxxxxxxxxx
password:
secret: smtp-password
key: password
authentication: login
starttls_auto: true
openssl_verify_mode: peerWatch the chart defaults: global.smtp.port is 2525 and starttls_auto is false. Bulko accepts 2525, but only with STARTTLS, so set starttls_auto: true explicitly or authentication will be refused. For port 465 use tls: true instead.
Send a test email
GitLab has no "Send test email" button. Open the Rails console on the server with sudo gitlab-rails console (it takes a while to start) and run:
ActionMailer::Base.delivery_method
# => :smtp
ActionMailer::Base.smtp_settings
# shows address, port, starttls/tls as GitLab sees them
Notify.test_email('[email protected]', 'GitLab SMTP test', 'It works').deliver_nowIf the relay accepts the message, the command returns a Mail::Message object without raising an error, and the email arrives within a minute. If it fails, the console prints the exception, for example Net::SMTPAuthenticationError or OpenSSL::SSL::SSLError.
The console sends directly, while real notifications go through Sidekiq's mailers queue. So after a successful console test, also request a password reset or add a comment to an issue. If those never arrive, check Admin Area -> Monitoring -> Background jobs for failed mailer jobs and /var/log/gitlab/sidekiq/current.
Keep the SMTP password out of gitlab.rb
gitlab.rb is often copied into backups and config repositories. The Linux package can keep the SMTP credentials in an encrypted file instead (default /var/opt/gitlab/gitlab-rails/shared/encrypted_settings/smtp.yaml.enc):
- Run
sudo gitlab-rake gitlab:smtp:secret:edit EDITOR=vim. - Enter the credentials as YAML:
user_name: 'smtp_xxxxxxxxxxxxxxxx' password: 'YOUR_BULKO_SMTP_PASSWORD' - Remove
smtp_user_nameandsmtp_passwordfrom/etc/gitlab/gitlab.rb. - Run
sudo gitlab-ctl reconfigure.
Only user_name and password are supported in this file; the host, port and TLS keys stay in gitlab.rb.
Troubleshooting
| Problem | Fix |
|---|---|
| Net::SMTPAuthenticationError: 535 Authentication failed | The username or password is wrong, or still in gitlab.rb after you moved it to the encrypted file. Paste both again from Dashboard -> SMTP Access, run gitlab-ctl reconfigure and retest. More: https://bulko.io/en/smtp-errors/535/. |
| OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: wrong version number) | Port and TLS mode do not match. Use port 587 or 2525 with smtp_enable_starttls_auto = true and smtp_tls = false, or port 465 with smtp_tls = true and smtp_enable_starttls_auto = false. |
| :enable_starttls and :tls are mutually exclusive | Both smtp_enable_starttls_auto and smtp_tls are true. Set exactly one of them, depending on the port, and run gitlab-ctl reconfigure. |
| Net::OpenTimeout: execution expired | The server cannot reach smtp.bulko.io on that port; cloud providers and firewalls often block outbound SMTP. Try port 2525 with STARTTLS, or open 587 outbound. |
| Console test works, but confirmation and notification emails never arrive | Real mail is sent by Sidekiq. Check failed jobs in Admin Area -> Monitoring -> Background jobs, make sure the mailers queue is routed to a running Sidekiq, and copy the SMTP settings to any external Sidekiq node. |
| Emails rejected or in spam because of the From address | The default From is gitlab@ your GitLab hostname. Set gitlab_email_from to an address on a domain you control and verify that domain in Bulko for DKIM. |
Reply by email and Service Desk need IMAP, not SMTP
GitLab's incoming email features (replying to a notification to comment, creating issues or merge requests by email, and Service Desk) read messages from a mailbox over IMAP (or Microsoft Graph for Exchange Online). Bulko is send-only: it has no IMAP, POP3 or mailboxes. Keep incoming_email and service_desk_email pointed at your existing mail provider and use Bulko only for the outgoing smtp_* settings. The Service Desk custom email address feature (Beta) also depends on a real mailbox that supports sub-addressing and forwards mail to GitLab.
FAQ
Can I configure SMTP in the GitLab Admin Area?
No. Outgoing SMTP is set only in configuration: gitlab.rb for the Linux package and Docker, global.smtp for the Helm chart, gitlab.yml/smtp_settings.rb for self-compiled installs. GitLab.com users cannot change it at all.
Which port should GitLab use with Bulko?
587 with STARTTLS (smtp_enable_starttls_auto true, smtp_tls false). Use 2525 the same way if 587 is blocked, or 465 with smtp_tls true and STARTTLS off. Port 25 is not offered.
Do I need smtp_ca_file or smtp_openssl_verify_mode 'none'?
No. smtp.bulko.io has a public Let's Encrypt certificate, so the default verification with 'peer' works and you should not switch to 'none'.
Can Bulko handle GitLab incoming email or Service Desk?
No. Those features read a mailbox over IMAP and Bulko is send-only. Keep incoming_email on your mail provider and use Bulko for outgoing notifications.
Is there a sending limit?
Each SMTP access can send 2,000 emails per day. That is plenty for notifications on most self-managed instances; a busy instance with many watchers per project should keep an eye on it.
How much does it cost?
Bulko SMTP Relay is a one-time package: $5 for 5,000 emails, $15 for 20,000, $30 for 50,000 or $60 for 150,000, with no subscription and no expiry.
Get SMTP credentials for GitLab
One-time payment by card or crypto, no subscription. Unused emails never expire. 2,000 emails per day per SMTP account.
What you can send: Acceptable Use Policy.