gitlab添加郵箱設置

郵箱是企業進行工做中的通知,交互必不可少的部分,gitlab一樣支持郵箱的配置,方便對一些操做有郵件的提醒,本文以QQ郵箱爲例,進行gitlab郵箱的添加。git

1、開啓smtp功能
dom

登錄郵箱==》設置==》帳戶==》POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服務==》開啓SMTP服務==》接收驗證ide

1.png

2.png

3.png


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

最後去郵箱中查看結果便可,以上操做皆驗證測試成功。

相關文章
相關標籤/搜索