gitlab设置smtp服务器

Posted wonder4

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gitlab设置smtp服务器相关的知识,希望对你有一定的参考价值。

$ sudo vi /etc/gitlab/gitlab.rb

# Change the external_url to the address your users will type in their browser

#Sending application email via SMTP

gitlab_rails['smtp_enable'] = true

gitlab_rails['smtp_address'] = "smtp.163.com"

gitlab_rails['smtp_port'] = 465

gitlab_rails['smtp_user_name'] = "xxuser@163.com"

gitlab_rails['smtp_password'] = "xxpassword"

gitlab_rails['smtp_domain'] = "163.com"

gitlab_rails['smtp_authentication'] = :login

gitlab_rails['smtp_enable_starttls_auto'] = true

##修改gitlab配置的发信人

gitlab_rails['gitlab_email_from'] = "xxuser@163.com"

user["git_user_email"] = "xxuser@163.com"


测试

root@02471662b839:/etc/gitlab# gitlab-rails console
Loading production environment (Rails 4.2.10)
irb(main):001:0> Notify.test_email('xxx@163.com','ttt','aeidafd').deliver_now


Notify#test_email: processed outbound mail in 173.4ms


Sent mail to qikun@163.com (309.0ms)
Date: Thu, 03 May 2018 04:30:24 +0000
From: git-noreply <xxxx@163.com>
Reply-To: git-noreply <xxxx@163.com>
To: xxx@163.com
Message-ID: <5aea90609dea0_8ae3fc2c54c70d05272c@02471662b839.mail>
Subject: ttt
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>aeidafd</p></body></html>


=> #<Mail::Message:70105427516320, Multipart: false, Headers: <Date: Thu, 03 May 2018 04:30:24 +0000>, <From: git-noreply <xxxx@163.com>>, <Reply-To: git-noreply <xxxx@163.com>>, <To: xxx@163.com>, <Message-ID: <5aea90609dea0_8ae3fc2c54c70d05272c@02471662b839.mail>>, <Subject: ttt>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>

以上是关于gitlab设置smtp服务器的主要内容,如果未能解决你的问题,请参考以下文章

gitlab配置邮箱服务

gitlab邮箱服务配置

Gitlab smtp 测试失败

gitlab服务器邮箱配置

配置gitlab通过smtp发送邮件

配置gitlab通过smtp发送邮件