Search code examples
ruby-on-railsemailsendmailsidekiqexim

Why can't I deliver emails using Sidekiq 3.3 and Rails 4.1?


I am currently using Rails 4.1.9 and Sidekiq 3.3.0 on a production environment (on a private physical server).

When I try to send emails using the delay method from Sidekiq using:

UserMailer.delay.new_user(user)

it happens that the mailer queue works correctly, the mail is dequeued and rendered, but it's not delivered. This is the only log I get on the sidekiq.log file:

2015-01-23T17:29:37.107Z 11266 TID-zo3e4 Sidekiq::Extensions::DelayedMailer JID-37f667c9ab5d446e07655ed6 INFO: start
  Rendered user_mailer/new_user.html.haml within layouts/mail (0.8ms)
2015-01-23T17:29:37.117Z 11266 TID-zo3e4 Sidekiq::Extensions::DelayedMailer JID-37f667c9ab5d446e07655ed6 INFO: done: 0.01 sec

Instead, if I call the usual method:

UserMailer.new_user(user).deliver

the mail gets rendered and delivered.

The app is configured to use sendmail for sending emails and I have exim4 installed and working on the server.

Is there any way I can fix this problem?


Solution

  • Sidekiq currently requires the mail object to have the (To | Bcc | Cc) and From attributes set.

    This will be fixed in 3.3.1 where it won't check these attributes.