Gitlab之163企业邮箱/腾讯企业邮箱SMTP发件配置-折腾笔记

首次安装Gitlab时SMTP发送邮件不能使用,当时没太在意,今日发现需要这个功能随探究一下。

一、环境

OS:Centos7

Version:GitLab 8.11.5

二、配置

1、打开/etc/gitlab/gitlab.rb

添加:

 gitlab_rails['smtp_enable'] = true
 gitlab_rails['smtp_address'] = "smtp.ym.163.com"
 gitlab_rails['smtp_port'] = 25
 gitlab_rails['smtp_user_name'] = "cloud@claves.me"
 gitlab_rails['smtp_password'] = "123456"
 gitlab_rails['smtp_domain'] = "claves.me"
 gitlab_rails['smtp_authentication'] = "login"
 gitlab_rails['gitlab_email_from'] = 'cloud@claves.me'
 gitlab_rails['gitlab_email_reply_to'] = 'cloud@claves.me'

腾讯企业邮箱:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "mail@claves.me"
gitlab_rails['smtp_password'] = "pwd"
gitlab_rails['smtp_domain'] = "mail.claves.me"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] =false
gitlab_rails['smtp_ssl'] =true
gitlab_rails['gitlab_email_from']="mail@claves.me"
gitlab_rails['gitlab_email_reply_to'] ="mail@claves.me"

 

2、使之生效

gitlab-ctl reconfigure
gitlab-ctl restart

三、测试

执行:

gitlab-rails console

键入:

irb(main):003:0> Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now

查看日志即可。

enjoy it !

参考链接


https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md

https://www.v2ex.com/t/200989

分享到:更多 ()