王艳玲 发表于 2018-1-11 17:52:28

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

  废话不说,直接给思路
  gitlab重部署后新加用户不发送激活邮件,配置如下:
  

gitlab_rails['smtp_enable']=true  
gitlab_rails[
'smtp_address']="smtp.exmail.qq.com"  
gitlab_rails[
'smtp_port']=465  
gitlab_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']=true  
gitlab_rails[
'smtp_tls']=true  
gitlab_rails[
'gitlab_email_from']="name@domain.com"  

  首先确认配置没问题,其次查看日志production.log
https://images2015.cnblogs.com/blog/1134848/201706/1134848-20170628003617399-2077033124.png
  log没有给出错误信息。那就直接开大招
  

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  

  发送测试邮件,此时会打印详细错误
https://images2015.cnblogs.com/blog/1134848/201706/1134848-20170628003906664-528436312.png
  TX返回一个553的错误和一个链接地址http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256
  此时真相大白,用第三方客户端登录QQ邮箱需要用授权码代替密码
页: [1]
查看完整版本: GITLAB email不发送腾讯企业邮箱解决方案