By default gitlab has the next configuration in gitlab.yml
:
email:
from: notify@gitlabhq.com
host: gitlabhq.com
but, I need to specify other variables (host, port, user, password, etc) to use another mail server.
How I do that?
By default gitlab has the next configuration in gitlab.yml
:
email:
from: notify@gitlabhq.com
host: gitlabhq.com
but, I need to specify other variables (host, port, user, password, etc) to use another mail server.
How I do that?
Now it is totally different in Gitlab 5.2+.
It is in "/home/git/gitlab/config/initializers/smtp_settings.rb.sample" and we just need to follow the instructions in that.
Note: This method was useful for older versions of Gitlab. See the answer of Girish for newer versions.
At the end of config/environments/production.rb you can add something like this:
Refer to the ActionMailer documentation for a more detailed description of possible configurations: http://api.rubyonrails.org/classes/ActionMailer/Base.html
Note: You may have to edit the file again after a Gitlab update
Apparently the location of these settings has changed (a few times) since this question was originally asked. Currently as of 2018-11-02:
The settings are in
gitlab.rb
as per the official documentation:https://docs.gitlab.com/omnibus/settings/smtp.html
For Gitlab > 7 omnibus, edit
/etc/gitlab/gitlab.rb
as below and runsudo gitlab-ctl reconfigure
Source: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md
This confused me too. But to change the mail setting you edit them in config/environments/production.rb Just add a config.action_mailer.smtp_settings like a regular rails app.
The
email:host:
configuration ingitlab.yml
isn't actually for the mail server/SMTP host. It's used to construct the links to your Gitlab host in the email. We call our gitlab server 'gitlab.local' (and have a DNS entry for it), so our configuration sayshost: gitlab.local
.This way, when users receive an email from Gitlab, the links will work, instead of linking to
http://localhost/
, as is the default.There's some redundant configuration in there. For the git clone URLs to be displayed correctly within Gitlab, you also need to configure
web:host:
andgit_host:host:
with the same host name.If you are using HTTPS, change
web:https:
,web:port:
, andemail:protocol:
.