1. 首先是拷贝Gitlab自带的example
2. 然后用我们自己的邮箱替换example中的邮箱
这里提供163和腾讯企业邮箱两种配置方式,注意将下面的123456替换成自己的密码
163:
腾讯企业邮箱:
3. 修改gitlab.yml
将默认邮箱修改为自己的邮箱
163:
腾讯企业邮箱:
4. 修改后。重启gitlab
注意事项:
1. 不需要修改 config/environments/production.rb,网上的其他文章说要修改这个文件可能是针对老版本的,gitlab7.0不需要修改这个文件(已测试)。
2. 腾讯企业邮箱不能使用其帮助网页上所写的465端口。设置了openssl_verify_mode也没有作用。若有人试验成功,请告知我,谢谢。]]>
1
2 |
cd /home/git/gitlab sudo -u git -H cp config /initializers/smtp_settings .rb.sample config /initializers/smtp_settings .rb |
1 |
sudo -u git -H vim config /initializers/smtp_settings .rb |
1
2
3
4
5
6
7
8
9
10
11
12 |
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 |
1
2
3
4
5
6
7
8
9
10
11
12 |
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 |
1
2 |
cd /home/git/gitlab sudo -u git -H vim config /gitlab .yml |
1
2
3 |
## Email settings # Email address used in the "From" field in mails sent by GitLab email_from: wpgit@163.com |
1
2
3 |
## Email settings # Email address used in the "From" field in mails sent by GitLab email_from: wangpeng@scnee.com |
1 |
sudo service gitlab restart |
评论区