aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/base.rb
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-25 13:39:48 +1100
committerJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-25 13:39:48 +1100
commite4a989e9d99b9860859ad14b5a6fca62a4009cf9 (patch)
tree3c1f8c125517c17d5709f3c7545199e2e59cd941 /actionmailer/lib/action_mailer/base.rb
parente1c131863897390d04bd5515765236590747f2c1 (diff)
downloadrails-e4a989e9d99b9860859ad14b5a6fca62a4009cf9.tar.gz
rails-e4a989e9d99b9860859ad14b5a6fca62a4009cf9.tar.bz2
rails-e4a989e9d99b9860859ad14b5a6fca62a4009cf9.zip
Added delivery_handler method to mail and implemented in ActionMailer to deliver inside of instrumentation
Diffstat (limited to 'actionmailer/lib/action_mailer/base.rb')
-rw-r--r--actionmailer/lib/action_mailer/base.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 552fd7ccb8..4e5e1bbb29 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -326,10 +326,19 @@ module ActionMailer #:nodoc:
end
end
- # TODO The delivery should happen inside the instrument block
- def delivered_email(mail) #:nodoc:
+ def deliver_mail(mail) #:nodoc:
ActiveSupport::Notifications.instrument("action_mailer.deliver") do |payload|
self.set_payload_for_mail(payload, mail)
+
+ if mail.perform_deliveries
+ begin
+ mail.deliver!
+ rescue Exception => e
+ raise e if mail.raise_delivery_errors
+ end
+ Mail.deliveries << mail
+ end
+
end
end