Gitlab Server Mail Setting

一、配置环境

Ubuntu + Gitlab + 腾讯企业邮箱

二、配置

配置文件:/etc/gitlab/gitlab.rb

### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'XXXXXX@XXXX.com'
gitlab_rails['gitlab_email_display_name'] = 'XXXXXX'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@XXXXX.com'
gitlab_rails['gitlab_email_subject_suffix'] = ''

#### IMAP Settings
gitlab_rails['incoming_email_host'] = "imap.exmail.qq.com"

### GitLab email server settings
###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
###! **Use smtp instead of sendmail/postfix.**
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "XXXXXX@XXXXXX.com"
gitlab_rails['smtp_password'] = "XXXXXX"
gitlab_rails['smtp_domain'] = "smtp.qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true

三、测试

gitlab-rails console
Notify.test_email('xxxxx@qq.com', '邮件标题', '邮件正文').deliver_now

四、配置生效

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

gitlab 配置文档


评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注