gitlab 邮箱无法发送

测试错误信息如下:

irb(main):002:0> Notify.test_email('joezhow777@gmail.com', '测试', '邮件测试').deliver_now

Notify#test_email: processed outbound mail in 1.9ms

Sent mail to joezhow777@gmail.com (30005.7ms)
Date: Fri, 20 Oct 2017 10:27:01 -0400
From: HLT_172LocalGitLab <joezhow777@163.com>
Reply-To: HLT_172LocalGitLab <joezhow777@163.com>
To: joezhow777@gmail.com
Message-ID: <59ea07b56932b_56ea3f8d962db12c3198b@m172.mail>
Subject: =?UTF-8?Q?=E6=B5=8B=E8=AF=95?=
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable
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-html40/loose.dtd">
<html><body><p>=E9=82=AE=E4=BB=B6=E6=B5=8B=E8=AF=95</p></body></html>

Net::OpenTimeout: execution expired
    from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:542:in `initialize'
    from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:542:in `open'
    from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:542:in `tcp_socket'
    from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:552:in `block in do_start'
    from /opt/gitlab/embedded/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
    from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:551:in `do_start'
    from /opt/gitlab/embedded/lib/ruby/2.3.0/net/smtp.rb:521:in `start'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:2149:in `do_delivery'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:237:in `block in deliver'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:543:in `block in deliver_mail'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/base.rb:541:in `deliver_mail'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/mail-2.6.5/lib/mail/message.rb:237:in `deliver'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/actionmailer-4.2.8/lib/action_mailer/message_delivery.rb:85:in `deliver_now'
    from (irb):2
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:110:in `start'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/console.rb:9:in `start'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:9:in `require'
    from bin/rails:9:in `<main>'

从反馈里看:

From: HLT_172LocalGitLab <joezhow777@163.com>
Reply-To: HLT_172LocalGitLab <joezhow777@163.com>

邮箱应该是设置成功了的,但是小白不明白为什么邮件还是发不出去呢?

补充配置文件:

clipboard.png

clipboard.png

-----10月21日更新

这可能是服务器在校园网内的原因,我在UCLoud上搭建服务器用这个配置没有问题,能成功发送邮件,在校园网的服务器里会出错,有经验的小伙伴可以指点下如何排查问题吗。

阅读 6k
2 个回答

gmail邮箱被墙了啊

已知阿里云和腾讯云的服务器,默认屏蔽25端口。题主可以考虑使用SSL发信。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进