Paritosh Piplewar
Paritosh Piplewar

Reputation: 8132

Delayed job is not sending email for specific email settings

I'm using delayed_job_active_record for pushing long running process to background. It works great except for email sending. It processes job and complete it but email never comes here. This problem is only on production.So, i tried switching the mailer setting back-and-forth and it turns out to be that if i use development setting it will work well but if i use production setting it doesn't.

I have tested the mailer setting without delayed_job, it works good in both environment so i am sure that the problem is not with email-settings.

In production environment

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'
}

In development enviornment

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

Any idea ?

Upvotes: 0

Views: 252

Answers (1)

Jeremy Green
Jeremy Green

Reputation: 8594

Are you setting RAILS_ENV when you start your workers?

RAILS_ENV=production script/delayed_job start

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

Upvotes: 1

Related Questions