GitLab
GitLab is a web-based software development and CI/CD platform. It enables teams to collaborate on code, host and manage Git repositories, track issues, and automate the software development lifecycle.
GitLab supports both cloud-hosted and self-managed deployments. Combined with its free plan, this makes it a popular choice for teams managing their own infrastructure.
Configuring GitLab SMTP settings
Edit your /etc/gitlab/gitlab.rb
file as shown below, and then run gitlab-ctl reconfigure
to apply the changes. After reconfiguring GitLab, you can test email delivery by triggering a password reset or using the Rails console to send a test email.
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "in.smtp.sendamatic.net"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "<your-mail-credential-username>" # https://docs.sendamatic.net/mail-credentials/
gitlab_rails['smtp_password'] = "<your-mail-credential-password>"
gitlab_rails['smtp_domain'] = "<your-mail-identity-domain>" # https://docs.sendamatic.net/mail-identities/
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = "example@<your-mail-identity-domain>"
gitlab_rails['gitlab_email_reply_to'] = "example@<your-mail-identity-domain>"
Sending a test email from GitLab
To verify your SMTP configuration, you can send a test email using the GitLab Rails console:
Once inside the console, run the following Ruby code:
Notify.test_email('[email protected]', 'Test Email from GitLab', 'This is a test email.').deliver_now
Replace [email protected]
with the recipient address you'd like to test. If the configuration is correct, GitLab will attempt to send the email using your SMTP settings.
To exit the console, type:
Troubleshooting
If your test email fails to send, here are a few things to check:
Check GitLab logs
Run the following command to view logs related to email delivery:
Look for errors related to SMTP authentication, connection timeouts, or DNS resolution.
Verify credentials and domain
- Ensure your SMTP username and password are correct.
- Confirm that
smtp_domain
matches the domain associated with your mail identity. - Make sure
gitlab_email_from
andgitlab_email_reply_to
use a verified domain.
Firewall and network access
Ensure your GitLab server can reach the SMTP server on the specified port (e.g., 587). You can test this with:
If telnet is not installed, try: