From a7ddb44abba2dca7c69b3c7e93284f8e51b6b988 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Fri, 23 Jan 2015 11:19:59 -0800 Subject: [PATCH] Dumb down ActionMailer integration, fixes #2149 --- Changes.md | 2 ++ lib/sidekiq/extensions/action_mailer.rb | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changes.md b/Changes.md index f8f0a26e..f98cdbcc 100644 --- a/Changes.md +++ b/Changes.md @@ -1,5 +1,7 @@ HEAD ----------- + +- Dumb down ActionMailer integration so it tries to deliver if possible [#2149] - Stringify Sidekiq.default_worker_options's keys [#2126] - Add random integer to process identity [#2113, michaeldiscala] - Log Sidekiq Pro's Batch ID if available [#2076] diff --git a/lib/sidekiq/extensions/action_mailer.rb b/lib/sidekiq/extensions/action_mailer.rb index 289f34e5..9d2d159d 100644 --- a/lib/sidekiq/extensions/action_mailer.rb +++ b/lib/sidekiq/extensions/action_mailer.rb @@ -17,7 +17,11 @@ module Sidekiq msg = target.public_send(method_name, *args) # The email method can return nil, which causes ActionMailer to return # an undeliverable empty message. - deliver(msg) if msg && (msg.to || msg.cc || msg.bcc) && msg.from + if msg + deliver(msg) + else + logger.warn("#{target.name}##{method_name} returned an undeliverable mail object") + end end private