Rails: delayed_job mail not sending
delayed-job, ruby-on-rails
Solution
Did you start at least 1 `delayed_job` worker?
rake jobs:work
Actually, when you call `delay`on an object, you are only queuing a job. Which means that a new entry will be created inside the `DelayedJob` table that contains all the metadata associated with your job.
So you still need something that will browse all your `DelayedJob`entries and run them one by one and that thing is the rake task (worker) shown above.
For production, it depends where you are deploying your application. On Heroku you only have to specify how many workers (`Worker dynos`) you need and they will start automatically.
Problem
I'm trying to use delayed_job gem https://github.com/collectiveidea/delayed_job in Rails 3.2 to send a mail in the background. I installed the gem ``` gem 'delayed_job_active_record' ``` I generated the table and ran the migrations, as instructed ``` $ rails generate delayed_job:active_record $ rake db:migrate ``` Noting that there are special instructions for mailers in Rails 3 ``` # without delayed_job Notifier.signup(@user).deliver # with delayed_job Notifier.delay.signup(@user) ``` I did ``` def send_welcome_email #UserMailer.welcome_email(self).deliver <-- original code that worked UserMailer.delay.welcome_email(self) end ``` but the mail isn't sending. It was working before I tried to use delayed_job... Can someone clarify for a novice...?