• SMTP connection pooling
  • Using encrypted credentials
  • Example configurations
  • Testing the SMTP configuration
  • Troubleshooting
  • Disable all outgoing email
  • SMTP settings

    If you would rather send application email via an SMTP server instead of via Sendmail or Postfix, add the following configuration information to /etc/gitlab/gitlab.rb and run gitlab-ctl reconfigure .

    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'
    

    SMTP connection pooling

    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 .

    Using encrypted credentials

    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:

    1. In /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:

    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:

    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

    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 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

    From the Uberspace Wiki :

    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

    SMTP Interface .

    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

    If you have figured out an example configuration yourself please send a Merge Request to save other people time.

    Testing the SMTP configuration

    You can verify that GitLab can send emails properly using the Rails console. On the GitLab server, execute gitlab-rails console to enter the console. Then, you can enter the following command at the console prompt to cause GitLab to send a test email:

    Troubleshooting

    Outgoing connections to port 25 is blocked on major cloud providers

    If you are using a cloud provider to host your GitLab instance and you are using port 25 for your SMTP server, it is possible that your cloud provider is blocking outgoing connections to port 25. This prevents GitLab from sending any outgoing mail. You can follow the instructions below to work around this depending on your cloud provider:

    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:

    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 caution
    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:

    1. Run a Rails console .
    2. 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.

    3. 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:

    This error occurs when both gitlab_rails['smtp_enable_starttls_auto'] and gitlab_rails['smtp_tls'] are set to true . If using SMTPS, set gitlab_rails['smtp_enable_starttls_auto'] to false . If using SMTP with STARTTLS, set gitlab_rails['smtp_tls'] to false . Run sudo gitlab-ctl reconfigure for the change to take effect.

    Disable all outgoing email note
    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