小编rla*_*mbe的帖子

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

我们使用 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 来实现?

heroku resque ruby-on-rails-4 mandrill rails-activejob

5
推荐指数
1
解决办法
1073
查看次数