Sameer Siruguri

My Blog

Silent Failures With Resque::Mailer

I was using Resque::Mailer, and couldn’t get it to work. I had what I thought was the simplest possible configuration –  in my mailer – app/mailers/user_mailer.rb – I had this:

class UserMailer < ActionMailer::Base
  include Resque::Mailer

  def alert_developers(u)
    mail(:to => "#{u.email} <#{u.email}>", :subject => "Hello").deliver
  end
end

But I was getting nothing – no new queue being created in Redis, and certainly no mails being sent.

It wasn’t until I removed the Resque::Mailer that I realized what was going on. The Mailer was in fact failing because no SMTP from field had been set, but that error is eaten up by Resque::Mailer. When you are not using Resque::Mailer, the error shows up in the resque-web application and it’s easier to debug.

When I put in a default From field in my config/application.rb file, everything worked great:


config.action_mailer.default_options = {from: "me@myplace.com"}

Now you know!

Single Post Navigation

Leave a Reply

Your email address will not be published. Required fields are marked *