From 2a6bc1263e99060897b53a8c806916d198eab572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 13 Jan 2010 11:56:11 +0100 Subject: Add subscriber to ActionMailer. --- actionmailer/lib/action_mailer/base.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 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 597260ab0b..13c9fbd516 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -399,9 +399,10 @@ module ActionMailer #:nodoc: # end # end def receive(raw_email) - logger.info "Received mail:\n #{raw_email}" unless logger.nil? mail = Mail.new(raw_email) - new.receive(mail) + ActiveSupport::Notifications.instrument("action_mailer.receive", :mail => mail) do + new.receive(mail) + end end # Deliver the given mail object directly. This can be used to deliver @@ -494,17 +495,13 @@ module ActionMailer #:nodoc: def deliver!(mail = @mail) raise "no mail object available for delivery!" unless mail - if logger - logger.info "Sent mail to #{Array(recipients).join(', ')}" - logger.debug "\n#{mail.encoded}" - end - - ActiveSupport::Notifications.instrument("action_mailer.deliver", :mail => self) do - begin + begin + ActiveSupport::Notifications.instrument("action_mailer.deliver", + :mail => @mail, :mailer => self) do self.delivery_method.perform_delivery(mail) if perform_deliveries - rescue Exception => e # Net::SMTP errors or sendmail pipe errors - raise e if raise_delivery_errors end + rescue Exception => e # Net::SMTP errors or sendmail pipe errors + raise e if raise_delivery_errors end mail -- cgit v1.2.3