Gitlab 4 0 email发送配置

本文详细介绍了如何解决GitLab邮件通知突然失效的问题,通过正确配置SMTP设置和解决sendmail错误,确保邮件通知正常发送。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

               

今天gitlab 的email提醒突然不工作了。需要增加配置,奇怪为什么之前那么神奇什么都不要配?

在config/gitlab.yml中设置:

  ## Email settings  # Email address used in the "From" field in mails sent by GitLab  #email_from: shu_chen@esri.com  from: your_account@your_mail.com  host: your_gitlab_server_host_name



在config/environment/production.rb文件中end前添加

  config.action_mailer.delivery_method = :smtp  config.action_mailer.smtp_settings = {      :address => 'your_smtp_server',      :port => 25,      :domain => 'your_gitlab_server_domain',      :authentication => :plain,      :user_name => 'your_account',      :password => 'your_password',      :enable_starttls_auto => true  }

还要安装sendmail

apt-get install sendmail

还是收不到email,检查一下日志,什么也没有。查看系统日志/var/log/syslog, 看到sendmail错误信息:

Feb 19 12:47:19 gitlab sendmail[42520]: My unqualified host name (gitlab) unknown; sleeping for retryFeb 19 12:48:19 gitlab sendmail[42520]: unable to qualify my own domain name (gitlab) -- using short nameFeb 19 12:48:19 gitlab sendmail[42520]: gethostbyaddr(10.112.18.182) failed: 2

原来是/etc/hosts配置的顺序问题:

127.0.0.1       localhost.localdomain localhost gitlab

记住,写成一行,并且localhost要放在机器名前面。

现在OK。


           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值