LINUX

关注公众号 jb51net

关闭
操作系统 > LINUX >

Linux系统下为Gitlab配置邮件提醒的方法详解

WNFK

Gitlab邮件提醒方便跟踪项目进度,在这里介绍两种方式,一种是用系统的sendmail发送邮件,另一种是GMAIL的stmp来发送邮件

第一种 用系统的sendmail发送邮件


cd /home/gitlab/gitlab/
vi config/environments/production.rb

将这行

# config.action_mailer.delivery_method = :sendmail

改为

config.action_mailer.delivery_method = :sendmail

保存

config/environments/production.rb

编辑config/gitlab.yml


vi config/gitlab.yml

对应修改一下配置


web:
host: gitlab123.com
port: 80
https: false
email:
from: notify@gitlab123.com
protocol: http
host: gitlab123.com
git_host:
host: gitlab123.com

编辑/etc/hosts

加入你的ip对应gitlab123.com


10.0.0.71 gitlab123.com

第二种 GMAIL的stmp来发送邮件


cd /home/gitlab/gitlab/
vi config/environments/production.rb

在# config.action_mailer.delivery_method = :sendmail下加入


config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => 'account@gmail.com',
:password => 'password',
:authentication => :plain,
:enable_starttls_auto => true
}
#配置好你的邮箱和密码

编辑config/gitlab.yml


vi config/gitlab.yml

对应修改一下配置


email:
from: account@gmail.com
protocol: http

PS:gitlab 配置腾讯企业邮箱
默认情况下,gitlab用qq邮箱注册是发送不出确认邮件的。
下面说说gitlab配置腾讯企业邮箱


# vim /etc/gitlab/gitlab.rb
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "support@ttlsa.com"
gitlab_rails['smtp_password'] = "www.ttlsa.com"
gitlab_rails['smtp_domain'] = "ttlsa.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = "support@ttlsa.com"

重新加载配置


# gitlab-ctl reconfigure