postfix启动报错
# vi /etc/postfix/main.cf
inet_interfaces = localhost
inet_protocols = all
邮箱配置
如想用 SMTP 代替 Sendmail 发送email,添加如下相应邮箱服务商的配置到
/etc/gitlab/gitlab.rb
, 然后运行gitlab-ctl reconfigure
使修改生效。 omnibus-gitlab还提供了测试发送邮件功能。
QQ exmail (腾讯企业邮箱)
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "xxxx@xx.com"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = 'xxxx@xx.com'
Office 365
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.office365.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "user.name@company.com"
gitlab_rails['smtp_password'] = "secret"
gitlab_rails['smtp_domain'] = "company.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
测试配置是否成功
配置完成后可以用Rails控制台验证邮件是否能发送成功。 在GitLab服务器上,执行 gitlab-rails console 进入控制台。 然后在控制台提示符后输入下面的命令 发送一封测试邮件:
irb(main):003:0> Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now
# 示例
Notify.test_email('收件人邮箱', '邮件标题', '邮件正文').deliver_now
关闭pipeline自动部署
# vi /etc/gitlab/gitlab.rb
gitlab_rails['gitlab_default_projects_features_builds'] = false