Commit 32f177dd authored by jplang's avatar jplang

Adds a X-Redmine-Sender header to email notifications (#5643).

git-svn-id: https://svn.redmine.org/redmine/trunk@8785 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 191872f4
......@@ -41,6 +41,7 @@ class Mailer < ActionMailer::Base
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue
@author = issue.author
recipients issue.recipients
cc(issue.watcher_recipients - @recipients)
subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
......@@ -394,6 +395,10 @@ class Mailer < ActionMailer::Base
cc.delete(@author.mail) if cc
end
if @author.logged?
redmine_headers 'Sender' => @author.login
end
notified_users = [recipients, cc].flatten.compact.uniq
# Rails would log recipients only, not cc and bcc
mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger
......
......@@ -138,6 +138,14 @@ class MailerTest < ActiveSupport::TestCase
assert_equal 'auto-generated', mail.header_string('Auto-Submitted')
end
def test_email_headers_should_include_sender
issue = Issue.find(1)
Mailer.deliver_issue_add(issue)
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
assert_equal issue.author.login, mail.header_string('X-Redmine-Sender')
end
def test_plain_text_mail
Setting.plain_text_mail = 1
journal = Journal.find(2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment