阅读量:1
-
安装Postfix(若未安装)
sudo apt update && sudo apt install postfix安装时选择“Internet Site”,设置系统邮件域名(如
yourdomain.com)。 -
配置Postfix
编辑/etc/postfix/main.cf,添加以下内容(以SMTP服务为例):myhostname = yourdomain.com relayhost = [smtp.yourmailprovider.com]:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_tls_security_level = encrypt在
/etc/postfix/sasl_passwd中添加SMTP凭据:[smtp.yourmailprovider.com]:587 your_email@example.com:your_password生成密码映射并重启Postfix:
sudo postmap /etc/postfix/sasl_passwd sudo systemctl restart postfix -
配置GitLab邮件设置
编辑/etc/gitlab/gitlab.rb:gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.yourmailprovider.com" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "your_email@example.com" gitlab_rails['smtp_password'] = "your_password" gitlab_rails['smtp_domain'] = "yourdomain.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true gitlab_rails['gitlab_email_from'] = 'your_email@example.com' # 设置发件人地址(若使用Gmail等,需将
smtp_tls设为false,并调整端口为465或587) -
重启GitLab并测试
sudo gitlab-ctl reconfigure sudo gitlab-ctl restart在GitLab管理界面(
Settings > General > Email)点击“Test email configuration”验证。
注意:
- 若使用外部SMTP(如Gmail),需在邮件服务商处启用“允许不够安全的应用”或生成应用专用密码。
- 日志路径:
/var/log/gitlab/gitlab-rails/production.log,用于排查配置错误。
以上就是关于“如何配置Debian GitLab的邮件通知”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm