快捷搜索:  汽车  科技

gitlab邮件(为gitlab配置QQ个人邮箱)

gitlab邮件(为gitlab配置QQ个人邮箱)gitlab_rails['smtp_user_name'] = "******@qq.com"gitlab_rails['smtp_port'] = 4652、修改gitlab的配置文件:sudo vim /etc/gitlab/gitlab.rbgitlab_rails['smtp_enable'] = truegitlab_rails['smtp_address'] = "smtp.qq.com"

废话少说吧直接上教程,配置邮箱的目的就是为了收发邮件方便。

1、开启qq邮箱的POP3/SMTP服务并保存好授权码

这一步在qq邮箱的设置 -> 账户中

gitlab邮件(为gitlab配置QQ个人邮箱)(1)

点击开启按照提示步骤操作会获得相应的授权码(注意:记住授权码一会要用)

2、修改gitlab的配置文件:sudo vim /etc/gitlab/gitlab.rb

gitlab_rails['smtp_enable'] = true

gitlab_rails['smtp_address'] = "smtp.qq.com"

gitlab_rails['smtp_port'] = 465

gitlab_rails['smtp_user_name'] = "******@qq.com"

gitlab_rails['smtp_password'] = "授权码"

gitlab_rails['smtp_domain'] = "smtp.qq.com"

gitlab_rails['smtp_authentication'] = "login"

gitlab_rails['smtp_enable_starttls_auto'] = true

gitlab_rails['smtp_tls'] = true

gitlab_rails['gitlab_email_from'] = '******@qq.com #注意这个一定要填写,不然会报502错误

至此配置文件修改完成

重启后生效:

sudo gitlab-ctl reconfigure

sudo gitlab-ctl restart (注:有人说不需要重启,看自己定吧,我是重启了一下)

3、测试配置是否成功

执行 gitlab-rails console进入控制台。然后执行测试发送邮件命令Notify.test_email(‘收件人邮箱’ ‘邮件标题’ ‘邮件正文’).deliver_now

当你看到以下提示时,那么恭喜你你配置成功啦

=> #<Mail::Message:70087079672280 Multipart: false Headers: <Date: Sat 28 Apr 2018 17:30:36 0800> <From: Example <xxxxxxx@qq.com>> <Reply-To: Example <xxxxxxx@qq.com>> <To: xxxxxxxx@qq.com> <Message-ID: <5ae43f3c5fb26_1b973fbe7ffdb0ec97358@ubu.mail>> <Subject: Message Subject test> <Mime-Version: 1.0> <Content-Type: text/html; charset=UTF-8> <Content-Transfer-Encoding: 7bit> <Auto-Submitted: auto-generated> <X-Auto-Response-Suppress: All>>

进游戏看看是否收到邮件了吗

至此配置完成,退出console控制台直接exit。

猜您喜欢: