diff options
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 9 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/deprecated_api.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/log_subscriber.rb | 22 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 3 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/railties/log_subscriber.rb | 22 |
5 files changed, 29 insertions, 29 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 9e3437685d..11fa978b9c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -4,6 +4,7 @@ require 'action_mailer/collector' require 'active_support/core_ext/array/wrap' require 'active_support/core_ext/object/blank' require 'active_support/core_ext/proc' +require 'action_mailer/log_subscriber' module ActionMailer #:nodoc: # Action Mailer allows you to send email from your application using a mailer model and views. @@ -182,7 +183,7 @@ module ActionMailer #:nodoc: # end # # Which will (if it had both a <tt>welcome.text.plain.erb</tt> and <tt>welcome.text.html.erb</tt> - # tempalte in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts, + # template in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts, # the first part being a <tt>multipart/alternative</tt> with the text and HTML email parts inside, # and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book # with the filename +free_book.pdf+. @@ -395,7 +396,7 @@ module ActionMailer #:nodoc: end # Wraps an email delivery inside of Active Support Notifications instrumentation. This - # method is actually called by the <tt>Mail::Message</tt> object itself through a call back + # method is actually called by the <tt>Mail::Message</tt> object itself through a callback # when you call <tt>:deliver</tt> on the Mail::Message, 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: @@ -534,7 +535,9 @@ module ActionMailer #:nodoc: # :reply_to => 'bounces@test.lindsaar.net' # end # - # If you need other headers not listed above, use the <tt>headers['name'] = value</tt> method. + # If you need other headers not listed above, you can either pass them in + # as part of the headers hash or use the <tt>headers['name'] = value</tt> + # method. # # When a <tt>:return_path</tt> is specified as header, that value will be used as the 'envelope from' # address for the Mail message. Setting this is useful when you want delivery notifications diff --git a/actionmailer/lib/action_mailer/deprecated_api.rb b/actionmailer/lib/action_mailer/deprecated_api.rb index c08ab4164e..0070d8e016 100644 --- a/actionmailer/lib/action_mailer/deprecated_api.rb +++ b/actionmailer/lib/action_mailer/deprecated_api.rb @@ -1,7 +1,7 @@ module ActionMailer # This is the API which is deprecated and is going to be removed on Rails 3.1 release. # Part of the old API will be deprecated after 3.1, for a smoother deprecation process. - # Chech those in OldApi instead. + # Check those in OldApi instead. module DeprecatedApi #:nodoc: extend ActiveSupport::Concern diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb new file mode 100644 index 0000000000..7ba57b19e0 --- /dev/null +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -0,0 +1,22 @@ +require 'active_support/core_ext/array/wrap' + +module ActionMailer + class LogSubscriber < ActiveSupport::LogSubscriber + def deliver(event) + recipients = Array.wrap(event.payload[:to]).join(', ') + info("\nSent mail to #{recipients} (%1.fms)" % event.duration) + debug(event.payload[:mail]) + end + + def receive(event) + info("\nReceived mail (%.1fms)" % event.duration) + debug(event.payload[:mail]) + end + + def logger + ActionMailer::Base.logger + end + end +end + +ActionMailer::LogSubscriber.attach_to :action_mailer
\ No newline at end of file diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index 43a4936013..d7b09b2dc6 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -5,9 +5,6 @@ module ActionMailer class Railtie < Rails::Railtie config.action_mailer = ActiveSupport::OrderedOptions.new - require "action_mailer/railties/log_subscriber" - log_subscriber :action_mailer, ActionMailer::Railties::LogSubscriber.new - initializer "action_mailer.logger" do ActiveSupport.on_load(:action_mailer) { self.logger ||= Rails.logger } end diff --git a/actionmailer/lib/action_mailer/railties/log_subscriber.rb b/actionmailer/lib/action_mailer/railties/log_subscriber.rb deleted file mode 100644 index af76d807d0..0000000000 --- a/actionmailer/lib/action_mailer/railties/log_subscriber.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'active_support/core_ext/array/wrap' - -module ActionMailer - module Railties - class LogSubscriber < Rails::LogSubscriber - def deliver(event) - recipients = Array.wrap(event.payload[:to]).join(', ') - info("\nSent mail to #{recipients} (%1.fms)" % event.duration) - debug(event.payload[:mail]) - end - - def receive(event) - info("\nReceived mail (%.1fms)" % event.duration) - debug(event.payload[:mail]) - end - - def logger - ActionMailer::Base.logger - end - end - end -end |