Gitlab设置不发送电子邮件

时间:2016-09-21 09:50:31

标签: email azure smtp gitlab

我正在尝试在windows azure中设置GitLab。我关注了这个博客Setup GitLab in azure,它充当了魅力。但我无法通过GitLab配置smtp邮件发送。

  • 我已按照此设置SMTP Setup。使用端口465和587
  • 尝试了Gmail和Zoho

我收到以下错误

2016-09-21_09:44:28.55626 2016-09-21T09:44:28.556Z 13562 TID-vskyw WARN: {"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActionMailer::DeliveryJob","queue":"mailers","args":[{"job_class":"ActionMailer::DeliveryJob","job_id":"6a954ac7-19d6-4b27-b28c-c511f25e6896","queue_name":"mailers","arguments":["DeviseMailer","confirmation_instructions","deliver_now",{"_aj_globalid":"gid://gitlab/User/1"},"tgShkQTx5e1sALoxkkGi",{"to":"<my email here>","_aj_symbol_keys":["to"]}],"locale":"en"}],"retry":true,"jid":"cbd7dc87ce4202265d1a6be7","created_at":1474450319.7324607,"enqueued_at":1474451065.2083879,"error_message":"end of file reached","error_class":"EOFError","failed_at":1474450320.9358478,"retry_count":5,"retried_at":1474451068.5555682}

2016-09-21_09:44:28.55639 2016-09-21T09:44:28.556Z 13562 TID-vskyw WARN: EOFError: end of file reached

  • 我尝试了各种SSL和TLS组合,但没有运气!

我正在使用GitLab 8.11.7

任何帮助都将不胜感激。

更新

我尝试使用GMail smtp,并且在允许使用此URL访问应用后工作正常。这个问题可能是由于某些Zoho的smtp政策

1 个答案:

答案 0 :(得分:0)

您应该使用新的smtp配置

  

如果您从源代码安装并使用SMTP发送邮件,则需要将以下行添加到config / initializers / smtp_settings.rb:

     

ActionMailer::Base.delivery_method = :smtp

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.10-to-8.11.md#smtp-configuration

所示

smtp_settings.rb的配置示例是:

if Rails.env.production?
  Rails.application.config.action_mailer.delivery_method = :smtp
  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    address: "email.server.com",
    port: 465,
    user_name: "smtp",
    password: "123456",
    domain: "gitlab.company.com",
    authentication: :login,
    enable_starttls_auto: true,
    openssl_verify_mode: 'peer' # See ActionMailer documentation for other possible options
  }
end

您可以在https://gitlab.com/gitlab-org/gitlab-ce/blob/8-12-stable/config/initializers/smtp_settings.rb.sample#L13找到用于配置SMTP的示例文档doc?

您可以在此处查看更多配置选项http://api.rubyonrails.org/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Configuration+options