![]() |
鼻子大的苹果 · 中国援埃塞俄比亚阿巴—萨姆尔水电站修复项目交接· 7 月前 · |
![]() |
阳刚的小马驹 · iPad 绘画课– 爱学美国· 1 年前 · |
![]() |
礼貌的课本 · 《恶魔少爷别吻我第一季》剧照- 知乎· 1 年前 · |
![]() |
悲伤的墨镜 · 深度揭秘:可转债打新为什么能赚钱?赚了谁的钱 ...· 1 年前 · |
![]() |
鬼畜的开水瓶 · 国家金融监督管理总局· 1 年前 · |
There are example configurations at the end of this page.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.server"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
# If your SMTP server does not like the default 'From: gitlab@localhost' you
# can change the 'From' with this setting.
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
# If your SMTP server is using a self signed certificate or a certificate which
# is signed by a CA which is not trusted by default, you can specify a custom ca file.
# Please note that the certificates from /etc/gitlab/trusted-certs/ are
# not used for the verification of the SMTP server certificate.
gitlab_rails['smtp_ca_file'] = '/path/to/your/cacert.pem'
Introduced in GitLab 13.5.
You can enable SMTP connection pooling with the following setting:
gitlab_rails['smtp_pool'] = true
This allows Sidekiq workers to reuse SMTP connections for multiple jobs. The maximum number of connections in the pool follows the maximum concurrency configuration for Sidekiq .
Introduced in GitLab 14.3.
Instead of storing the SMTP credentials in the configuration files as plain text, you can optionally use an encrypted file for the SMTP credentials. To use this feature, you first need to enable GitLab encrypted configuration .
The encrypted configuration for SMTP exists in an encrypted YAML file. By default the file will be created at
/var/opt/gitlab/gitlab-rails/shared/encrypted_configuration/smtp.yaml.enc
. This location is configurable in the GitLab configuration.
The unencrypted contents of the file should be a subset of the settings from your
smtp_*'
settings in the
gitlab_rails
configuration block.
The supported configuration items for the encrypted file are:
user_name
password
The encrypted contents can be configured with the SMTP secret edit Rake command .
Configuration
If initially your SMTP configuration looked like:
/etc/gitlab/gitlab.rb
:
gitlab_rails['smtp_enable'
] = true
gitlab_rails['smtp_address'] = "smtp.server"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
Edit the encrypted secret:
sudo gitlab-rake gitlab:smtp:secret:edit EDITOR=vim
The unencrypted contents of the SMTP secret should be entered like:
user_name: 'smtp user'
password: 'smtp password'
Edit /etc/gitlab/gitlab.rb
and remove the settings for smtp_user_name
and smtp_password
.
Reconfigure GitLab:
sudo gitlab-ctl reconfigure
Example configurations
SMTP on localhost
SMTP without SSL
Gmail
Gmail has strict sending limits
that can impair functionality as your organization grows. We strongly recommend using a
transactional service like SendGrid or Mailgun
for teams using SMTP configuration.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "[email protected]"
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' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
Don’t forget to change
[email protected]
to your email address and
my-gmail-password
to your own password.
If you encounter authentication errors, ensure you have
allowed less secure apps to access the account
or try
turning on 2-step validation
and using
an application password
.
Google SMTP relay
You can route outgoing non-Gmail messages through Google
using Google’s SMTP relay service
.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp-relay.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_domain'] = "yourdomain.com"
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
Mailgun
Amazon Simple Email Service (AWS SES)
Using STARTTLS
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "email-smtp.region-1.amazonaws.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "IAMmailerKey"
gitlab_rails['smtp_password'] = "IAMmailerSecret"
gitlab_rails['smtp_domain'] = "yourdomain.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
Make sure to permit egress through port 587 in your ACL and security group.
-
Using TLS Wrapper
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "email-smtp.region-1.amazonaws.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "IAMmailerKey"
gitlab_rails['smtp_password'] = "IAMmailerSecret"
gitlab_rails['smtp_domain'] = "yourdomain.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_ssl'] = true
gitlab_rails['smtp_force_ssl'] = true
Make sure to permit egress through port 465 in your ACL and security group.
Mandrill
SMTP.com
You can use the
SMTP.com
email service.
Retrieve your sender login and password
from your account.
To improve delivery by authorizing
SMTP.com
to send emails on behalf of your domain, you should:
-
Specify
from
and
reply_to
addresses using your GitLab domain name.
-
Set up SPF and DKIM for the domain
.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = 'send.smtp.com'
gitlab_rails['smtp_port'] = 25 # If your outgoing port 25 is blocked, try 2525, 2082
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_authentication'] = 'plain'
gitlab_rails['smtp_user_name'] = 'your_sender_login'
gitlab_rails['smtp_password'] = 'your_sender_password'
gitlab_rails['smtp_domain'] = 'your.gitlab.domain.com'
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['gitlab_email_reply_to'] = '[email protected]'
Check the
SMTP.com Knowledge Base
for further assistance.
SparkPost
Gandi
Zoho Mail
This configuration was tested on Zoho Mail with a custom domain.
SiteAge, LLC Zimbra Mail
Outlook
Office365
Office365 relay
Online.net
Amen.fr / Securemail.pro
yahoo
QQ exmail
NetEase Free Enterprise Email
NetEase Free Enterprise Email (网易免费企业邮)
SendGrid with username/password authentication
SendGrid with API Key authentication
If you don’t want to supply a username/password, you can use an
API key
:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.sendgrid.net"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "apikey"
gitlab_rails['smtp_password'] = "the_api_key_you_created"
gitlab_rails['smtp_domain'] = "smtp.sendgrid.net"
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
# If use Single Sender Verification You must configure from. If not fail
# 550 The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved.
# Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements
gitlab_rails['gitlab_email_from'] = 'email@sender_owner_api'
gitlab_rails['gitlab_email_reply_to'] = 'email@sender_owner_reply_api'
Note that
smtp_user_name
must literally be set to
"apikey"
.
The API Key you created must be entered in
smtp_password
.
Sendinblue
This configuration was tested with Sendinblue’s
SMTP relay service
. To grab the relevant account credentials via the URLs commented into this example,
log in to your Sendinblue account
. For further details, refer to Sendinblue’s
help page
.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp-relay.sendinblue.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "<[email protected]>" # https://app.sendinblue.com/settings/keys/smtp
gitlab_rails['smtp_password'] = "<password>" # https://app.sendinblue.com/settings/keys/smtp
gitlab_rails['smtp_domain'] = "<example.com>"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '<[email protected]>'
gitlab_rails['gitlab_email_reply_to'] = '<[email protected]>'
SMTP2GO
This configuration was tested using
SMTP2GO
. To get the relevant account credentials using the URLs commented in this example,
sign in to your SMTP2GO account
.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mail.smtp2go.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "<username>" # https://app.smtp2go.com/settings/users
gitlab_rails['smtp_password'] = "<password>" # https://app.smtp2go.com/settings/users
gitlab_rails['smtp_domain'] = "<example.com>" # https://app.smtp2go.com/settings/sender_domains
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
Yandex
UD Media
Microsoft Exchange (no authentication)
Microsoft Exchange (with authentication)
Strato.de
Rackspace
DomainFactory (df.eu)
Infomaniak (infomaniak.com)
GoDaddy (TLS)
European servers: smtpout.europe.secureserver.net
Asian servers: smtpout.asia.secureserver.net
Global (US) servers: smtpout.secureserver.net
gitlab_rails['gitlab_email_from'] = '[email protected]'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtpout.secureserver.net"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = "domain.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
GoDaddy (No TLS)
See GoDaddy (TLS) entry above for mail server list.
OpenSRS (hostedemail.com)
Aruba (aruba.it)
Alibaba Cloud Direct Mail (No TLS)
Alibaba Cloud Direct Mail (TLS)
Aliyun Direct Mail
Aliyun Enterprise Mail with TLS
Aliyun Enterprise Mail with TLS (阿里企业邮箱)
FastMail
FastMail requires an
App Password
even when two-step verification is not enabled.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.fastmail.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "app-specific-password"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
Dinahosting
GMX Mail
Hetzner
Snel.com
JangoSMTP
Mailjet
Mailcow
ALL-INKL.COM
webgo.de
mxhichina.com
Postmark
easyDNS (outbound mail)
Check if it’s available/enabled and configuration settings in the
control panel
.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "mailout.easydns.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_force_ssl'] = true
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_user_name'] = "example.com"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_password'] = "password_you_set"
gitlab_rails['gitlab_email_from'] = '[email protected]'
Campaign Monitor
Freehostia
Mailbox.org
Mittwald CM Service (mittwald.de)
Unitymedia (.de)
united-domains AG (united-domains.de)
IONOS by 1&1 (ionos.de)
AWS Workmail
From the
AWS workmail documentation
:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.server"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
Open Telekom Cloud
Uberspace 6
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "<your-host>.uberspace.de"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "<your-user>@<your-domain>"
gitlab_rails['smtp_password'] = "<your-password>"
gitlab_rails['smtp_domain'] = "<your-domain>"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
Tipimail
Netcup
Mail-in-a-Box
NIFCLOUD ESS
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.ess.nifcloud.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "SMTP user name"
gitlab_rails['smtp_password'] = "SMTP user password"
gitlab_rails['smtp_domain'] = "smtp.ess.nifcloud.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_reply_to'] = '[email protected]'
Check the SMTP user name and SMTP user password from the ESS
dashboard
.
gitlab_email_from
and
gitlab_email_reply_to
must be ESS authenticated sender email addresses.
Sina mail
User needs first to enabled SMTP through the mailbox settings via web mail interface and get the authenitication code. Check out more details in the
help page
of Sina mail.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.sina.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "authentication code"
gitlab_rails['smtp_domain'] = "smtp.sina.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'
Feishu mail
Check out more details in the
help page
of Feishu mail.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.feishu.cn"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "your-user@your-domain"
gitlab_rails['gitlab_email_from'] = "[email protected]"
gitlab_rails['smtp_domain'] = "yourdomain.com"
gitlab_rails['smtp_password'] = "authentication code"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = true
Hostpoint
For more information about Hostpoint email visit their
help page
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "asmtp.mail.hostpoint.ch"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "authentication code"
gitlab_rails['smtp_domain'] = "asmtp.mail.hostpoint.ch"
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'
Fastweb (fastweb.it)
Scaleway Transactional Email
Read more about
Scaleway’s Transactional Email
.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.tem.scw.cloud"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "transactional_email_user_name"
gitlab_rails['smtp_password'] = "secret_key_of_api_key"
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
More examples are welcome
Testing the SMTP configuration
Troubleshooting
Outgoing connections to port 25 is blocked on major cloud providers
-
AWS:
How do I remove the restriction on port 25 from my Amazon EC2 instance or AWS Lambda function?
-
Azure:
Troubleshoot outbound SMTP connectivity problems in Azure
-
GCP:
Sending email from an instance
Wrong version number when using SSL/TLS
Many users run into the following error after configuring SMTP:
This error is usually due to incorrect settings:
If your SMTP provider is using port 25 or 587, SMTP connections start
unencrypted
but can be upgraded via
STARTTLS
. Be sure the
following settings are set:
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false # This is the default and can be omitted
gitlab_rails['smtp_ssl'] = false # This is the default and can be omitted
If your SMTP provider is using port 465, SMTP connections start
encrypted over TLS. Ensure the following line is present:
gitlab_rails['smtp_tls'] = true
For more details, read
about the confusion over SMTP ports, TLS, and STARTTLS
.
Emails not sending when using external Sidekiq
If your instance has
an external Sidekiq
configured, the SMTP configuration must be present in
/etc/gitlab/gitlab.rb
on the external Sidekiq server. If
the SMTP configuration is missing, you may notice that emails do not get sent through SMTP as many
GitLab emails are sent via Sidekiq.
Emails not sending when using Sidekiq routing rules
If you are using Sidekiq
routing rules
, your configuration might be missing the
mailers
queue which is required for outgoing mail.
For more details, review the
example configuration
.
Email not sent
Any command that changes data directly could be damaging if not run correctly, or under the right conditions. We highly recommend running them in a test environment with a backup of the instance ready to be restored, just in case.
If you have correctly configured an email server, but email is not sent:
-
Run a
Rails console
.
-
Check the
ActionMailer
delivery_method
. It must match the type of server you’re using, either
:smtp
for an SMTP server or
:sendmail
for Sendmail:
intended. If you configured SMTP, it should say
:smtp
. If you’re using
Sendmail, it should say
:sendmail
:
irb(main):001:0> ActionMailer::Base.delivery_method
=> :smtp
If you’re using SMTP, check the mail settings:
irb(main):002:0> ActionMailer::Base.smtp_settings
=> {:address=>"localhost", :port=>25, :domain=>"localhost.localdomain", :user_name=>nil, :password=>nil, :authentication=>nil, :enable_starttls_auto=>true}
In the example above, the SMTP server is configured for the local machine. If this is intended, check your local mail
logs (for example, /var/log/mail.log
) for more details.
-
Send a test message using the console:
irb(main):003:0> Notify.test_email('[email protected]', 'Hello World', 'This is a test message').deliver_now
If you do not receive an email or see an error message, check your mail server settings.
Email not sent when using STARTTLS and SMTP TLS
You may encounter the following error if both STARTTLS and SMTP TLS are enabled:
Disable all outgoing email
This will disable
all
outgoing email from your GitLab instance, including but not limited to notification emails, direct mentions, and password reset emails.
In order to disable
all
outgoing email, you can edit or add the following line to
/etc/gitlab/gitlab.rb
:
gitlab_rails['gitlab_email_enabled'] = false
Run
sudo gitlab-ctl reconfigure
for the change to take effect.
Help & feedback
Docs
Edit this page
to fix an error or add an improvement in a merge request.
Create an issue
to suggest an improvement to this page.
Product
Create an issue
if there's something you don't like about this feature.
Propose functionality
by submitting a feature request.
Join First Look
to help shape new features.
Feature availability and product trials
View pricing
to see all GitLab tiers and features, or to upgrade.
Try GitLab for free
with access to all features for 30 days.
Get Help
If you didn't find what you were looking for,
search the docs
.
If you want help with something specific and could use community support,
post on the GitLab forum
.
For problems setting up or using this feature (depending on your GitLab
subscription).
Request support
![]() |
鼻子大的苹果 · 中国援埃塞俄比亚阿巴—萨姆尔水电站修复项目交接 7 月前 |
![]() |
阳刚的小马驹 · iPad 绘画课– 爱学美国 1 年前 |
![]() |
礼貌的课本 · 《恶魔少爷别吻我第一季》剧照- 知乎 1 年前 |
![]() |
鬼畜的开水瓶 · 国家金融监督管理总局 1 年前 |