Anders Anders - 1 month ago 8
Ruby Question

Rails 4.2 - Sidekiq not sending emails in development

I have a rails app in which I have a method where I send a lot of emails. I would like to perform this action

asynchronously
. To do it I've tried to use
Sidekiq
, but I can't get it to work properly - it doesn't send any emails.

Sending email worked before, so I'm certain that my email settings is set ut correctly.

In my
gemfile
I have this:

gem 'sidekiq'


And I have run
bundle install
. I have also install
redis
, followed the instructions on RailsCasts #366.

I have started
sidekiq
with the following command:
bundle exec sidekiq
, this resulted in what can be seen in the image below:

enter image description here

In
application.rb
I have the following:

config.active_job.queue_adapter = :sidekiq


And I try to send the emails like this:

Mailer.deliver_new_competition_notification(member.user, @competition).deliver_later!


I don't get any errors, but the emails never gets sent.

So, have I missed something?

Answer

You need to bootup sidekiq with the mailer queue for it to pick up these jobs:

bundle exec sidekiq -q default -q mailers

The Sidekiq Wiki goes over the scenarios in detail here.

Comments