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/railties | |
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/railties')
-rw-r--r-- | actionmailer/lib/action_mailer/railties/subscriber.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionmailer/lib/action_mailer/railties/subscriber.rb b/actionmailer/lib/action_mailer/railties/subscriber.rb new file mode 100644 index 0000000000..aafc155b09 --- /dev/null +++ b/actionmailer/lib/action_mailer/railties/subscriber.rb @@ -0,0 +1,20 @@ +module ActionMailer + module Railties + class Subscriber < Rails::Subscriber + def deliver(event) + recipients = Array(event.payload[:mailer].recipients).join(', ') + info("Sent mail to #{recipients} (%1.fms)" % event.duration) + debug("\n#{event.payload[:mail].encoded}") + end + + def receive(event) + info("Received mail (%.1fms)" % event.duration) + debug("\n#{event.payload[:mail].encoded}") + end + + def logger + ActionMailer::Base.logger + end + end + end +end
\ No newline at end of file |