1、邮箱设置中开启smtp服务,注意开启后保存好授权码后面要用
2、修改gitlab配置文件
3、修改文件中下面信息
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'] = "LEYNCHTPFPRWFXXX" (***此处填写邮箱开启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
4、加载配置文件并重启
gitlab-ctl reconfigure
gitlab-ctl restart
5、测试
gitlab-rails console
Notify.test_email('731182XXX@qq.com', 'GitLab email', 'Hellow world').deliver_now
6、去邮箱查看是否收到邮件