【问题标题】:Delayed job is not sending email for specific email settings延迟作业未针对特定电子邮件设置发送电子邮件
【发布时间】:2014-11-18 20:31:43
【问题描述】:

我正在使用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 }

有什么想法吗?

【问题讨论】:

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


    【解决方案1】:

    你在启动你的worker时是否设置RAILS_ENV

    RAILS_ENV=production script/delayed_job start
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-08
      • 2012-03-18
      • 1970-01-01
      • 2011-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多