gitlab邮箱配置步骤

1)开启QQ邮箱(网易邮箱)的smtp服务并获取授权码

2)修改GitLab配置

vi /etc/gitlab/gitlab.rb

修改如下配置:
qq邮箱
gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = “smtp.qq.com”
gitlab_rails[‘smtp_port’] = 465
gitlab_rails[‘smtp_user_name’] = “xxx@qq.com”
gitlab_rails[‘smtp_password’] = “开启QQ邮箱的smtp服务时获取的授权码”
gitlab_rails[‘smtp_domain’] = “qq.com”
gitlab_rails[‘smtp_authentication’] = “login”
gitlab_rails[‘smtp_enable_starttls_auto’] = true
gitlab_rails[‘smtp_tls’] = true
user[‘git_user_email’] = “xxx@qq.com”
gitlab_rails[‘gitlab_email_from’] = ‘xxx@qq.com’

网易邮箱
gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = “smtp.163.com”
gitlab_rails[‘smtp_port’] = 465
gitlab_rails[‘smtp_user_name’] = “xxx@163.com”
gitlab_rails[‘smtp_password’] = “开启网易邮箱的smtp服务时获取的授权码”
gitlab_rails[‘smtp_domain’] = “smtp.163.com”
gitlab_rails[‘smtp_authentication’] = “login”
gitlab_rails[‘smtp_enable_starttls_auto’] = true
gitlab_rails[‘smtp_tls’] = true
gitlab_rails[‘gitlab_email_from’] = “xxx@163.com”
user[‘git_user_email’] = “xxx@163.com”

3)重新配置GitLab

gitlab-ctl reconfigure

4)测试邮件服务是否正常

gitlab-rails console
Notify.test_email(‘接收方邮件地址’,‘邮件标题’,‘邮件内容’).deliver_now