码迷,mamicode.com
首页 > 其他好文 > 详细

gitlab配置邮箱服务

时间:2019-12-20 18:43:23      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:net   tla   rtt   配置邮箱   env   ipa   cto   class   content   


当需要进行 账号注册,创建项目,或合并分支等操作时,可通过邮件通知、邮件验证的方式实现。

1. SMTP服务

用于配置在服务端Gitlab注册用户时的邮件发送确认动作

我使用的是163邮箱,说一下注意点,登录163邮箱,开启“POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务”,并设置授权码;授权码用于下面gitlab配置中的发件箱密码

技术图片

2. 服务端配置

$ cat >> /etc/gitlab/gitlab.rb<<EOF
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "发件箱名.163.com"
gitlab_rails['smtp_password'] = "授权码"
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'] = '发件箱名.163.com'
user['git_user_email'] = "发件箱名.163.com"
EOF

3. 更新配置

$ gitlab-ctl stop
$ gitlab-ctl reconfigure
$ gitlab-ctl start

4. 邮件测试

$ gitlab-rails console
Loading production environment (Rails 4.2.10)
irb(main):001:0> Notify.test_email('542303xxx@qq.com', '邮件标题', '邮件正文').deliver_now

Notify#test_email: processed outbound mail in 243.5ms

Sent mail to 542303xxx@qq.com (365.9ms)
Date: Mon, 10 Dec 2018 16:21:51 +0800
From: GitLab <kailevxxx@163.com>
Reply-To: GitLab <noreply@122.xxx.204.xxx>
To: 542303xxx@qq.com
....
...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www=
.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>=E9=82=AE=E4=BB=B6=E6=AD=A3=E6=96=87</p></body></html>

=> #<Mail::Message:70175369260100, Multipart: false, Headers: <Date: Mon, 10 Dec 2018 16:21:51 +0800>, <From: GitLab <kailevxxx@163.com>>, <Reply-To: GitLab <noreply@122.xxx.204.xxx>>, <To: 542303xxx@qq.com>, <Message-ID: <5c0e221f2a160_7b623fd311ddb0fc25ac@gitlab.mail>>, <Subject: 邮件标题>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: quoted-printable>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>

等待半分钟左右,如下图所示,配置完成

技术图片


?
[sleepy↓]





?

gitlab配置邮箱服务

标签:net   tla   rtt   配置邮箱   env   ipa   cto   class   content   

原文地址:https://www.cnblogs.com/sunhongleibibi/p/12074315.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!