Gitlab smtp测试失败

Gitlab smtp test failed

我正在使用 gitlab 社区版(综合安装)。我尝试配置 SMTP 设置,但在测试配置时出现错误。我相信我们的 smtp 地址没有用户名和密码。

 gitlab_rails['smtp_enable'] = true
 gitlab_rails['smtp_address'] = "xx.xxxx.com"
 gitlab_rails['smtp_port'] = 465
 gitlab_rails['smtp_enable_starttls_auto'] = true
 gitlab_rails['smtp_tls'] = false
 gitlab_rails['smtp_openssl_verify_mode'] = 'none'

请告诉我如何解决此错误。我无法理解错误在哪里。

 GitLab:       11.3.1 (32cb452)
 GitLab Shell: 8.3.3
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> ActionMailer::Base.delivery_method
=> :smtp
irb(main):002:0> Notify.test_email('xx.xx@xxx.com', 'Hello World', 'This is test')


    Notify#test_email: processed outbound mail in 210.3ms

Sent mail to xx.xx@xx.com (30012.0ms)
Date: Thu, 15 Nov 2018 23:24:13 +0000
From: GitLab <gitlab@xx.com>
Reply-To: GitLab <gitlab@xx.com>
To: xx.xx@xxx.com
Message-ID: <5bee001d73945_d693fc0e59daf4021724@ip-10-xx-x-xx.mail>
Subject: Hello World
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-htm
<html><body><p>This is a test message</p></body></html>

Net::OpenTimeout: execution expired
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `initialize'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `open'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:539:in `tcp_socket'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:549:in `block in do_start'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/timeout.rb:103:in `timeout'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:548:in `do_start'
        from /opt/gitlab/embedded/lib/ruby/2.4.0/net/smtp.rb:518:in `start'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/network/deliion'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/network/deli
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_m
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_strument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_`instrument'
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/activesupport-4.2.10/lib/active_
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_m
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/mail-2.7.0/lib/mail/message.rb:2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/actionmailer-4.2.10/lib/action_m'
        from (irb):2
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/comman
        from bin/rails:14:in `require'
        from bin/rails:14:in `<main>'
irb(main):003:0> exit

你和issue 22728有同样的情况,但升级后似乎消失了。
在你的情况下,你已经是最新版本(几乎:检查 11.4 是否有帮助)

Issue 23600 指出阻止传出 smtp 的云提供商。

还要检查 "Mail not working" section 以确保以下值:

  • ActionMailer::Base.delivery_method
  • ActionMailer::Base.smtp_settings