1、编辑gitlab配置文件
vim /etc/gitlab/gitlab.rb
gitlab_rails[‘gitlab_email_enabled‘] = true gitlab_rails[‘gitlab_email_from‘] = ‘2546523862@qq.com‘ #发件人邮箱 gitlab_rails[‘gitlab_email_display_name‘] = ‘lina-gitlab‘ #发件人名称 gitlab_rails[‘smtp_enable‘] = true gitlab_rails[‘smtp_address‘] = "smtp.qq.com" #邮箱服务器 gitlab_rails[‘smtp_port‘] = 465 gitlab_rails[‘smtp_user_name‘] = "2546523862@qq.com" #发件人邮箱地址 gitlab_rails[‘smtp_password‘] = "nkunufnvhxpvebii" #qq邮箱的授权码 gitlab_rails[‘smtp_domain‘] = "qq.com" gitlab_rails[‘smtp_authentication‘] = "login" gitlab_rails[‘smtp_enable_starttls_auto‘] = true gitlab_rails[‘smtp_tls‘] = true
2、重新加载配置文件
gitlab-ctl reconfigure
3、测试邮箱
gitlab-rails console
Notify.test_email("xxx@qq.com","title","gitlab").deliver_now #模拟发邮件
同上,稍微有点区别配置文件
gitlab_rails[‘gitlab_email_enabled‘] = true gitlab_rails[‘gitlab_email_from‘] = ‘xxx@bonc.com.cn‘ gitlab_rails[‘gitlab_email_display_name‘] = ‘Gitlab-System‘ gitlab_rails[‘smtp_enable‘] = true gitlab_rails[‘smtp_address‘] = "mail.bonc.com.cn" #服务器地址 gitlab_rails[‘smtp_port‘] = 465 gitlab_rails[‘smtp_user_name‘] = "xxx@bonc.com.cn" gitlab_rails[‘smtp_password‘] = "xxxxxx" #发件人邮箱密码 gitlab_rails[‘smtp_domain‘] = "bonc.com.cn" gitlab_rails[‘smtp_authentication‘] = "login" gitlab_rails[‘smtp_enable_starttls_auto‘] = true gitlab_rails[‘smtp_tls‘] = true user[‘git_user_email‘] = "bxsybkf@bonc.com.cn" #发件人邮箱
原文:https://www.cnblogs.com/lina-2159/p/13434791.html