Gitlab smtp 测试失败

Posted

技术标签:

【中文标题】Gitlab smtp 测试失败【英文标题】:Gitlab smtp test failed 【发布时间】:2019-04-19 06:26:41 【问题描述】:

我正在使用 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

【问题讨论】:

【参考方案1】:

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

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

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

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

【讨论】:

以上是关于Gitlab smtp 测试失败的主要内容,如果未能解决你的问题,请参考以下文章

.gitlab-ci.yml 管道中的 Plotly-Dash 测试因 NameError 失败:未定义名称“DashComposite”

为啥我的 .gitlab-ci.yml 在纱线测试中不断失败,并出现错误“/bin/sh: 1: react-scripts: not found”?

由于 webdriver-manager 未被识别为内部或外部命令,Gitlab CI 端到端测试失败

gitlab ci 管道部署 ftp 失败

Gitlab CI 失败:未找到 NPM 命令

将 Capybara 升级到最新版本导致 Gitlab CI 失败