1. 首先是拷貝Gitlab自帶的examplegit
cd /home/git/gitlab sudo -u git -H cp config/initializers/smtp_settings.rb.sample config/initializers/smtp_settings.rb
2. 而後用咱們本身的郵箱替換example中的郵箱shell
sudo -u git -H vim config/initializers/smtp_settings.rb
這裏提供163和騰訊企業郵箱兩種配置方式,注意將下面的123456替換成本身的密碼vim
163:dom
if Rails.env.production? Gitlab::Application.config.action_mailer.delivery_method = :smtp ActionMailer::Base.smtp_settings = { address: "smtp.163.com", port: 25, user_name: "wpgitlab", password: "123456", domain: "163.com", authentication: :plain, enable_starttls_auto: true } end
騰訊企業郵箱:
gitlab
if Rails.env.production? Gitlab::Application.config.action_mailer.delivery_method = :smtp ActionMailer::Base.smtp_settings = { address: "smtp.exmail.qq.com", port: 25, user_name: "wangpeng@scnee.com", password: "123456", domain: "smtp.qq.com", authentication: :plain, enable_starttls_auto: true, } end
3. 修改gitlab.yml測試
cd /home/git/gitlab sudo -u git -H vim config/gitlab.yml
將默認郵箱修改成本身的郵箱rest
163:
code
## Email settings # Email address used in the "From" field in mails sent by GitLab email_from: wpgit@163.com
騰訊企業郵箱:ssl
## Email settings # Email address used in the "From" field in mails sent by GitLab email_from: wangpeng@scnee.com
4. 修改後。重啓gitlabopenssl
sudo service gitlab restart
注意事項:
1. 不須要修改 config/environments/production.rb,網上的其餘文章說要修改這個文件多是針對老版本的,gitlab7.0不須要修改這個文件(已測試)。
2. 騰訊企業郵箱不能使用其幫助網頁上所寫的465端口。設置了openssl_verify_mode也沒有做用。如有人試驗成功,請告知我,謝謝。