邮箱是企业进行工做中的通知,交互必不可少的部分,gitlab一样支持邮箱的配置,方便对一些操做有邮件的提醒,本文以QQ邮箱为例,进行gitlab邮箱的添加。git
1、开启smtp功能
dom
登录邮箱==》设置==》帐户==》POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务==》开启SMTP服务==》接收验证ide
2、修改配置文件gitlab
[root@localhost opt]# grep -rn "^[^#]" /etc/gitlab/gitlab.rb 测试
13:external_url 'http://192.168.0.8:81'url
57:gitlab_rails['gitlab_email_from'] = 'w135xxx@qq.com'rest
58:gitlab_rails['smtp_enable'] = trueblog
59:gitlab_rails['smtp_address'] = "smtp.qq.com"it
60:gitlab_rails['smtp_port'] = 465io
61:gitlab_rails['smtp_user_name'] = "w135xxx@qq.com"
62:gitlab_rails['smtp_password'] = "cknzlfrvhwmbbagf"
63:gitlab_rails['smtp_domain'] = "smtp.qq.com"
64:gitlab_rails['smtp_authentication'] = "login"
65:gitlab_rails['smtp_enable_starttls_auto'] = true
66:gitlab_rails['smtp_tls'] = true
3、加载配置文件并重启gitlab
[root@localhost opt]# gitlab-ctl reconfigure
[root@localhost opt]# gitlab-ctl restart
4、验证
[root@localhost opt]# gitlab-rails console
irb(main):001:0>
Notify.test_email('232xxxx@qq.com', 'GitLab email', 'Hellow world').deliver_now
Notify#test_email: processed outbound mail in 363.2ms
Sent mail to 232xxxx@qq.com (1902.1ms)
Date: Wed, 13 Feb 2019 10:21:31 +0800
From: GitLab <w135xxxx@qq.com>
Reply-To: GitLab <noreply@192.168.0.8>
To: 232xxxx@qq.com
最后去邮箱中查看结果便可,以上操做皆验证测试成功。