[分享] 为Gitlab配置邮件服务器

为我们的极狐GItlab配置一个邮件服务吧~

安装邮件服务器

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

开启POP3/SMTP

QQ邮箱-设置-账户-帐户安全-开启服务-POP3/SMTP服务-生成授权码-发个短信

授权码:xxxxxxxxx

gitlab配置

修改/etc/gitlab/gitlab.rb

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "1234567@qq.com"  # 你自己QQ号
gitlab_rails['smtp_password'] = "xxxxxxxxxxx"             # QQ授权码
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['gitlab_email_from'] = '1234567@qq.com'   # 你自己QQ号
gitlab-ctl  reconfigure

测试你的邮箱配置

gitlab-rails console
Notify.test_email('希望收到的邮箱地址', '邮件标题_test', '邮件正文_test').deliver_now