From 383b8bc8e215d5fa2b018d6f0b9c363ea95251cf Mon Sep 17 00:00:00 2001 From: Yoshiyuki Kinjo Date: Sat, 8 Sep 2018 17:14:12 +0900 Subject: Skip delivery notification when perform_deliveries is false. --- actionmailer/lib/action_mailer/base.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionmailer/lib/action_mailer/base.rb') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 7f22af83b0..1ab2c55a6c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -579,6 +579,7 @@ module ActionMailer # calling +deliver_mail+ directly and passing a Mail::Message will do # nothing except tell the logger you sent the email. def deliver_mail(mail) #:nodoc: + return unless mail.perform_deliveries ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload| set_payload_for_mail(payload, mail) yield # Let Mail do the delivery actions -- cgit v1.2.3 From 576209b45bf6d20e91562da77e454bc58bda3658 Mon Sep 17 00:00:00 2001 From: Yoshiyuki Kinjo Date: Sun, 9 Sep 2018 20:16:20 +0900 Subject: Add `perform_deliveries` to a payload of `deliver.action_mailer` notification. --- actionmailer/lib/action_mailer/base.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'actionmailer/lib/action_mailer/base.rb') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 1ab2c55a6c..55f701b18e 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -579,7 +579,6 @@ module ActionMailer # calling +deliver_mail+ directly and passing a Mail::Message will do # nothing except tell the logger you sent the email. def deliver_mail(mail) #:nodoc: - return unless mail.perform_deliveries ActiveSupport::Notifications.instrument("deliver.action_mailer") do |payload| set_payload_for_mail(payload, mail) yield # Let Mail do the delivery actions @@ -589,15 +588,16 @@ module ActionMailer private def set_payload_for_mail(payload, mail) - payload[:mailer] = name - payload[:message_id] = mail.message_id - payload[:subject] = mail.subject - payload[:to] = mail.to - payload[:from] = mail.from - payload[:bcc] = mail.bcc if mail.bcc.present? - payload[:cc] = mail.cc if mail.cc.present? - payload[:date] = mail.date - payload[:mail] = mail.encoded + payload[:mailer] = name + payload[:message_id] = mail.message_id + payload[:subject] = mail.subject + payload[:to] = mail.to + payload[:from] = mail.from + payload[:bcc] = mail.bcc if mail.bcc.present? + payload[:cc] = mail.cc if mail.cc.present? + payload[:date] = mail.date + payload[:mail] = mail.encoded + payload[:perform_deliveries] = mail.perform_deliveries end def method_missing(method_name, *args) -- cgit v1.2.3