gitlab配置通过smtp发送邮件(QQ exmail腾讯企业为例)
首先祭出官网文档链接:https://docs.gitlab.com/omnibus/settings/smtp.html
其实官网已经说的很清楚了,并且给出了QQ邮箱的范例(BAT还是屌的)
1. 编辑/etc/gitlab/gitlab.rb
文件(加到文件最后面就好了)。以QQ企业邮箱为例:
1
2
3
4
5
6
7
8
9
gitlab_rails[‘smtp_enable‘] = true
gitlab_rails[‘smtp_address‘] = "smtp.exmail.qq.com"
gitlab_rails[‘smtp_port‘] = 465
gitlab_rails[‘smtp_user_name‘] = "[email protected]"
gitlab_rails[‘smtp_password‘] = "******"
gitlab_rails[‘smtp_authentication‘] = "login"
gitlab_rails[‘smtp_enable_starttls_auto‘] = true
gitlab_rails[‘smtp_tls‘] = true
gitlab_rails[‘gitlab_email_from‘] = ‘[email protected]‘
有的教程可能会说去改
/opt/gitlab/etc/gitlab.rb
,是错的,一切以官网文档为准
2. 重新配置gitlab
1
gitlab-ctl reconfigure
3. 通过命令行测试邮件是否发送成功(也可以不测)
1
2
gitlab-rails console
irb(main):003:0> Notify.test_email(‘[email protected]‘, ‘Message Subject‘, ‘Message Body‘).deliver_now
原文地址:https://www.cnblogs.com/adolfmc/p/9400368.html
时间: 2024-10-18 10:50:35