返回介绍

PART Ⅰ : 容器云OPENSHIFT

PART Ⅱ:容器云 KUBERNETES

PART Ⅲ:持续集成与持续部署

PART Ⅴ:日志/监控/告警

PART Ⅵ:基础

PART Ⅶ:数据存储、处理

PART VIII:CODE

PART X:HACKINTOSH

PART XI:安全

配置SMTP邮件服务

发布于 2024-06-08 21:16:47 字数 3944 浏览 0 评论 0 收藏 0

### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '******@163.com'
gitlab_rails['gitlab_email_display_name'] = 'Curiouser163SMTPServer'
gitlab_rails['gitlab_email_reply_to'] = '*****@163.com'
gitlab_rails['gitlab_email_subject_suffix'] = 'Gitlab'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "******@163.com"
gitlab_rails['smtp_password'] = "******"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = false

注意

  1. 当使用Docker镜像部署时,相关Gitlab参数可追加在环境变量“GITLAB_OMNIBUS_CONFIG”的值中进行配置。详见:https://docs.gitlab.com/omnibus/docker/gitlab的安装与配置

  2. 测试发送邮件

$ gitlab-rails console
Loading production environment (Rails 4.2.10)

# 查看发送邮件使用的方式。方式有smtp和sendmail两种
$ irb(main):001:0> ActionMailer::Base.delivery_method
# 查看 SMTP 相关的配置
$ irb(main):001:0> ActionMailer::Base.smtp_settings
# 发送测试邮件
$ irb(main):001:0> Notify.test_email('******@163.com','gitlab send mail test','gitlab test mail').deliver_now

Notify#test_email: processed outbound mail in 539.6ms

Sent mail to ******@163.com (397.8ms)
Date: Thu, 04 Jul 2019 15:07:33 +0000
From: Curiouser163SMTPServer<******@163.com>
Reply-To: Curiouser163SMTPServer<******@163.com>
To:******@163.com
Message-ID: <5d1e1635e507c_5c13fa113ac91001075d@gitlab-ce-18-9cj5x.mail>
Subject: gitlab send mail test
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>gitlab test mail</p></body></html>=> #<Mail::Message:69960855039000, Multipart: false, Headers: <Date: Thu, 04 Jul 2019 15:07:33 +0000>, <From: Curiouser163SMTPServer<******@163.com>>, <Reply-To: Curiouser163SMTPServer<******@163.com>>, <To: rationalmonster@16
3.com>, <Message-ID: <5d1e1635e507c_5c13fa113ac91001075d@gitlab-ce-18-9cj5x.mail>>, <Subject: gitlab send mail test>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: a
uto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):002:0>

  1. https://docs.gitlab.com/omnibus/settings/smtp.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文