Rohit
Rohit

Reputation: 677

delayed_job rake jobs:work rails 4 not sending mail

UserMailer with delay method not working in rails 4. As mentioned below, this code doesn't works

def welcome_email
  UserMailer.delay.welcome_email(self)
end

But when I use below code it works fine.

UserMailer.welcome_email(self).deliver

I have installed 2 gems, i.e

gem 'delayed_job'
gem 'delayed_job_active_record'

Upvotes: 1

Views: 294

Answers (1)

Krishna Vyas
Krishna Vyas

Reputation: 285

You need to pass ENV variables to your worker command. Use this command in your command line:

rake jobs:work RAILS_ENV=development VARIABLE_1='' VARIABLE_2=''

Upvotes: 1

Related Questions