gitlab搭建后邮件服务设置
按照官网配置会有坑
官方详解邮件服务配置
1. 配置文件位置/etc/gitlab/gitlab.rb
以腾讯企业邮箱为例其它邮箱大同小异
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "邮箱地址"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_domain'] = "exmail.qq.com"
gitlab_rails['gitlab_email_from'] = '邮箱地址'
端口号实际测试是465,gitlab给出的是587
2.更新配置 gitlab-ctl reconfigure
(测试发现控制台调试第四步生效了,但是页面发送邮件并没有立即生效)
3.重启服务 gitlab-ctl restart
4.非必需步骤进入控制台gitlab-rails console (测试邮件服务是否正常)
Notify.test_email("XXX@XXX.XX","title","gitlab").deliver_now
备注
gitlab_rails[‘smtp_user_name’] 与gitlab_rails[‘gitlab_email_from’] 不一致会导致501报错