GITLAB email不发送腾讯企业邮箱解决方案

来源:互联网 发布:女变男网络电影 编辑:程序博客网 时间:2024/06/10 09:52

废话不说,直接给思路

gitlab重部署后新加用户不发送激活邮件,配置如下:

gitlab_rails['smtp_enable']=truegitlab_rails['smtp_address']="smtp.exmail.qq.com"gitlab_rails['smtp_port']=465gitlab_rails['smtp_user_name']="name@domain.com"gitlab_rails['smtp_password']="pass"gitlab_rails['smtp_domain']="doamin.com"gitlab_rails['smtp_authentication']="login"gitlab_rails['smtp_enable_starttls_auto']=truegitlab_rails['smtp_tls']=truegitlab_rails['gitlab_email_from']="name@domain.com"
  1. 首先确认配置没问题
  2. 查看日志production.log, 也没有给出错误信息
  3. 开大招 sudo gitlab-rails console production
irb(main):001:0> ActionMailer::Base.delivery_method=> :smtp确保method为smtp,错了就是配置写错了或者没被正确加载irb(main):002:0> ActionMailer::Base.smtp_settings=> {:address=>"localhost", :port=>25, :domain=>"localhost.localdomain", :user_name=>nil, :password=>nil, :authentication=>nil, :enable_starttls_auto=>true}`确保配置是我们要的irb(main):003:0> Notify.test_email('youremail@email.com', 'Hello World', 'This is a test message').deliver_now发送测试邮件,此时会打印详细错误
TX返回一个553的错误和一个链接地址 http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256

此时真相大白,用第三方客户端登录QQ邮箱需要用授权码代替密码