阿里云Centos7gitlab配置完163邮箱后无法发送邮件

1.修改gitlab.rb配置项

目录:/etc/gitlab/gitlab.rb

 

修改:

gitlab_rails['smtp_enable'] = true

gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "xxx"【授权码,去对应邮箱设置】
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true

gitlab_rails['smtp_tls'] = true

gitlab_rails['gitlab_email_from'] = '[email protected]'

user['git_user_email'] = "[email protected]"

注意port端口配置成465以前的25端口阿里云已经关闭了

2.重启gilab配置

修改后执行gitlab-ctl reconfigure

3.进入rails控制台测试邮件发送

gitlab-rails console
irb(main):003:0> Notify.test_email('[email protected]', 'Message Subject', 'Message Body').deliver_now

# 示例Notify.test_email('收件人邮箱', '邮件标题', '邮件正文').deliver_now

若发送不成功请看下是否配置user['git_user_email'],若以上都配置了请查看下阿里云服务器安全组有没有开放465端口

你可能感兴趣的:(阿里云Centos7gitlab配置完163邮箱后无法发送邮件)