##// END OF EJS Templates
Adds a X-Redmine-Sender header to email notifications (#5643)....
Jean-Philippe Lang -
r8665:967f42aa98f5
parent child
Show More
@@ -41,6 +41,7 class Mailer < ActionMailer::Base
41 41 'Issue-Author' => issue.author.login
42 42 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
43 43 message_id issue
44 @author = issue.author
44 45 recipients issue.recipients
45 46 cc(issue.watcher_recipients - @recipients)
46 47 subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
@@ -394,6 +395,10 class Mailer < ActionMailer::Base
394 395 cc.delete(@author.mail) if cc
395 396 end
396 397
398 if @author.logged?
399 redmine_headers 'Sender' => @author.login
400 end
401
397 402 notified_users = [recipients, cc].flatten.compact.uniq
398 403 # Rails would log recipients only, not cc and bcc
399 404 mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
@@ -138,6 +138,14 class MailerTest < ActiveSupport::TestCase
138 138 assert_equal 'auto-generated', mail.header_string('Auto-Submitted')
139 139 end
140 140
141 def test_email_headers_should_include_sender
142 issue = Issue.find(1)
143 Mailer.deliver_issue_add(issue)
144 mail = ActionMailer::Base.deliveries.last
145 assert_not_nil mail
146 assert_equal issue.author.login, mail.header_string('X-Redmine-Sender')
147 end
148
141 149 def test_plain_text_mail
142 150 Setting.plain_text_mail = 1
143 151 journal = Journal.find(2)
General Comments 0
You need to be logged in to leave comments. Login now