Mandrill SMTP 给出 EOFError:文件结束到达错误

rla*_*mbe 5 heroku resque ruby-on-rails-4 mandrill rails-activejob

我们使用 Mandrill 从我们的 Rails 应用程序(在 Heroku 上)发送交易电子邮件。

# config/environments/production.rb
config.action_mailer.delivery_method = :smtp  
config.action_mailer.smtp_settings = {
  :address   => "smtp.mandrillapp.com",
  :port      => 587,
  :enable_starttls_auto => true,
  :user_name => ENV['MANDRILL_USERNAME'],
  :password  => ENV['MANDRILL_PASSWORD'],
  :authentication => 'login',
  :domain => ENV['URL_OPTIONS_HOST'],
} 
Run Code Online (Sandbox Code Playgroud)

当我们发送电子邮件时,我们使用 ActiveJob 和 Deliver_later,在后台使用 Resque 发送电子邮件。

有时,也许每 2-3 天一次,我们会收到以下错误:

EOFError: end of file reached
File "/app/bin/rake" line 8 in <main>
....
"queue_name": "production_mailers", "job_class": "ActionMailer::DeliveryJob"
Run Code Online (Sandbox Code Playgroud)

我认为这是由 Mandrill 的 SMTP 超时问题引起的。

有谁知道如何避免这个错误?是否最好重试失败的电子邮件,如果是这样,如何使用 ActiveJob 和 Resque 来实现?

kel*_*ins 4

我也看到这个问题。并不是每次发送都会发生这种情况,我的大部分发送都是通过 resque 作业完成的。我想知道这是山魈这边的暂时性问题还是网络问题。

  • +1,我们偶尔也会看到它。考虑转向基于 API 的发送。你们中的任何一个找到解决这个问题的方法了吗? (2认同)