1. 編輯/etc/gitlab/gitlab.rb文件(加到文件最後面就行了)。以QQ企業郵箱爲例:html
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.exmail.qq.com" gitlab_rails['smtp_port'] = 465 gitlab_rails['smtp_user_name'] = "ala.it@alaven.com" gitlab_rails['smtp_password'] = "Alad111222" gitlab_rails['smtp_domain'] = "alaven.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['smtp_tls'] = true gitlab_rails['gitlab_email_from'] = 'ala.it@alaven.com'
有的教程可能會說去改/opt/gitlab/etc/gitlab.rb,是錯的,一切以官網文檔爲準git
2. 從新配置gitlabcentos
gitlab-ctl reconfigure
3. 經過命令行測試郵件是否發送成功(也能夠不測)dom
gitlab-rails console irb(main):003:0> Notify.test_email('123456789@qq.com', 'Message Subject', 'Message Body').deliver_now