求支招,自己的私有 gitlab 服务器,配置了 ActionMailer,用 smtp 来发送通知邮件。配置如下:
if Rails.env.production?
Gitlab::Application.config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: "smtp.163.com",
port: 25,
user_name: "*****************",
password: "**************",
domain: "163.com",
authentication: :login,
enable_starttls_auto: false,
openssl_verify_mode: 'none' # See ActionMailer documentation for other possible options
}
end
用的是 163 邮箱服务器,向其他用户发送通知邮件。
前段时间是可以正常发送通知邮件的,这几天不知什么原因,收不到邮件了,检查 sidekiq 的日志如下:
Sidekiq::Extensions::DelayedMailer JID-b694bbc959b6972dec24430c INFO: start
2016-09-21T00:11:42.086Z 30161 TID-ouhh3htik Sidekiq::Extensions::DelayedMailer JID-b694bbc959b6972dec24430c INFO: fail: 30.018 sec
2016-09-21T00:11:42.087Z 30161 TID-ouhh3htik WARN: {"retry"=>true, "queue"=>"default", "class"=>"Sidekiq::Extensions::DelayedMailer", "args"=>["---\n- !ruby/class 'Notify'\n- :new_ssh_key_email\n- - 874\n"], "jid"=>"b694bbc959b6972dec24430c", "enqueued_at"=>1474169870.4743142, "error_message"=>"execution expired", "error_class"=>"Net::OpenTimeout", "failed_at"=>1474169908.4454546, "retry_count"=>17, "retried_at"=>1474416702.0864198}
2016-09-21T00:11:42.087Z 30161 TID-ouhh3htik WARN: execution expired
2016-09-21T00:11:42.087Z 30161 TID-ouhh3htik WARN: /usr/local/lib/ruby/2.1.0/net/smtp.rb:541:in `initialize'
/usr/local/lib/ruby/2.1.0/net/smtp.rb:541:in `open'
/usr/local/lib/ruby/2.1.0/net/smtp.rb:541:in `tcp_socket'
/usr/local/lib/ruby/2.1.0/net/smtp.rb:551:in `block in do_start'
/usr/local/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
/usr/local/lib/ruby/2.1.0/timeout.rb:101:in `call'
/usr/local/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
/usr/local/lib/ruby/2.1.0/net/smtp.rb:550:in `do_start'
/usr/local/lib/ruby/2.1.0/net/smtp.rb:520:in `start'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/mail-2.6.4/lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/mail-2.6.4/lib/mail/message.rb:2149:in `do_delivery'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `block in deliver'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionmailer-4.1.14.1/lib/action_mailer/base.rb:527:in `block in deliver_mail'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14.1/lib/active_support/notifications.rb:159:in `block in instrument'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14.1/lib/active_support/notifications.rb:159:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionmailer-4.1.14.1/lib/action_mailer/base.rb:525:in `deliver_mail'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/mail-2.6.4/lib/mail/message.rb:237:in `deliver'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/extensions/action_mailer.rb:32:in `deliver'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/extensions/action_mailer.rb:20:in `perform'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:75:in `execute_job'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:127:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidetiq-0.6.3/lib/sidetiq/middleware/history.rb:8:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/logging.rb:22:in `with_context'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:132:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:51:in `block in process'
"sidekiq.log" [readonly] 11741L, 1309001C
我不太了解 163 邮箱服务器,postfix 和目标邮箱服务器之间是怎么交互的,google 了一下 尝试在服务器上上用命令: telnat smtp.163.com 25 来连接 163 的邮箱服务器,结果一直连不上
telnet smtp.163.com 25
Trying 220.181.12.14...
Trying 220.181.12.15...
Trying 220.181.12.16...
不知道跟这个有没有关系,目前这个问题还没有解决,求助同志们