延迟作业未发送特定电子邮件设置的电子邮件

时间:2013-10-12 12:13:43

标签: ruby-on-rails-3 delayed-job

我正在使用delayed_job_active_record将长时间运行的进程推送到后台。除电子邮件发送外,它的效果很好。它处理工作并完成它,但电子邮件永远不会来到这里。这个问题只出现在生产上。所以,我尝试来回切换邮件设置,结果是如果我使用开发设置它会很好,但如果我使用生产设置它不会。

我已经测试了没有delayed_job的邮件程序设置,它在两个环境中都运行良好,因此我确信问题不在于电子邮件设置。

在生产环境中

config.action_mailer.default_url_options = { :host => 'www.xyz.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings =  {
  :address        => 'smtp.sendgrid.net',
  :port           => '587',
  :authentication => :plain,
  :user_name      => 'xyz',
  :password       => 'password123',
  :domain         => 'heroku.com'
}

在发展环境中

config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您在启动工作人员时是否设置了RAILS_ENV

RAILS_ENV=production script/delayed_job start

https://github.com/collectiveidea/delayed_job#running-jobs

相关问题