Gitlab-邮件服务器配置
官网邮件服务配置参考文档:https://docs.gitlab.com/omnibus/settings/smtp.html#example-configurations需要邮箱配置SMTP服务
修改gitlab配置-邮件服务(126邮箱为例)
vim /etc/gitlab/gitlab.rb
#开启smtp
gitlab_rails['smtp_enable'] = true
#126smtp地址
gitlab_rails['smtp_address'] = "smtp.126.com"
#smtp地址
gitlab_rails['smtp_port'] = 465
#smtp用户名
gitlab_rails['smtp_user_name'] = "example@126.com"
#smtp密码
gitlab_rails['smtp_password'] = "smtp_password"
#126域名
gitlab_rails['smtp_domain'] = "126.com"
#授权方式
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
#需要与gitlab_rails['smtp_user_name'] 值一样
gitlab_rails['gitlab_email_from'] = 'example@126.com'
#发送邮件展示的名称
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
重新配置
gitlab-ctl reconfigure
控制台测试
#打开gitlab控制台,时间有点长,需要耐心等待
gitlab-rails console
#发送邮件测试
#Notify.test_email('接收人邮箱地址','邮件主题','邮件内容').deliver_now
Notify.test_email('example@163.com','gitlab邮件配置','测试邮件内容').deliver_now
界面测试邮件功能
出现的错误
gitlab_rails[‘gitlab_email_from’] 与gitlab_rails[‘smtp_user_name’]参数值不一致
Traceback (most recent call last):
1: from (irb):1
Net::SMTPFatalError (553 Mail from must equal authorized user)
gitlab_rails[‘smtp_port’] 端口错误,smtp官方端口为25,但是无法使用,gitlab配置ssl连接网易邮箱需要使用465端口
Traceback (most recent call last):
1: from (irb):1
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: wrong version number)
irb(main):002:0>
页:
[1]