diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-13 11:56:11 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-14 01:07:03 +0100 |
commit | 2a6bc1263e99060897b53a8c806916d198eab572 (patch) | |
tree | 89198bdaf7ffdcafae1039be17ab8a9d04faf7db /actionmailer/lib/action_mailer/base.rb | |
parent | d01716731bd9c68de686d6ac85e3da5251305495 (diff) | |
download | rails-2a6bc1263e99060897b53a8c806916d198eab572.tar.gz rails-2a6bc1263e99060897b53a8c806916d198eab572.tar.bz2 rails-2a6bc1263e99060897b53a8c806916d198eab572.zip |
Add subscriber to ActionMailer.
Diffstat (limited to 'actionmailer/lib/action_mailer/base.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 19 |
1 files changed, 8 insertions, 11 deletions
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 |