summaryrefslogtreecommitdiffstats
path: root/config/initializers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-21 03:38:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-10-21 03:38:54 +0000
commitf09be683232748ba649de6b3c1b62f901d9247b8 (patch)
tree40f66bffe28221787e044659b3a68ef396eee698 /config/initializers
parent82eab51203fb85df454408207ac180e30e2c8acf (diff)
downloadredmine-f09be683232748ba649de6b3c1b62f901d9247b8.tar.gz
redmine-f09be683232748ba649de6b3c1b62f901d9247b8.zip
Adds cc and bcc to email log messages (#12090).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10683 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/10-patches.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb
index 52e26a25b..79641513e 100644
--- a/config/initializers/10-patches.rb
+++ b/config/initializers/10-patches.rb
@@ -125,6 +125,24 @@ ActionMailer::Base.add_delivery_method :async_smtp, DeliveryMethods::AsyncSMTP
ActionMailer::Base.add_delivery_method :async_sendmail, DeliveryMethods::AsyncSendmail
ActionMailer::Base.add_delivery_method :tmp_file, DeliveryMethods::TmpFile
+# Changes how sent emails are logged
+# Rails doesn't log cc and bcc which is misleading when using bcc only (#12090)
+module ActionMailer
+ class LogSubscriber < ActiveSupport::LogSubscriber
+ def deliver(event)
+ recipients = [:to, :cc, :bcc].inject("") do |s, header|
+ r = Array.wrap(event.payload[header])
+ if r.any?
+ s << "\n #{header}: #{r.join(', ')}"
+ end
+ s
+ end
+ info("\nSent email \"#{event.payload[:subject]}\" (%1.fms)#{recipients}" % event.duration)
+ debug(event.payload[:mail])
+ end
+ end
+end
+
module ActionController
module MimeResponds
class Collector