##// END OF EJS Templates
Add the following headers to email notifications (#830, #247):...
Jean-Philippe Lang -
r1250:f271e772afba
parent child
Show More
@@ -23,6 +23,10 class Mailer < ActionMailer::Base
23 23 include ActionController::UrlWriter
24 24
25 25 def issue_add(issue)
26 redmine_headers 'Project' => issue.project.identifier,
27 'Issue-Id' => issue.id,
28 'Issue-Author' => issue.author.login
29 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
26 30 recipients issue.recipients
27 31 subject "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] (#{issue.status.name}) #{issue.subject}"
28 32 body :issue => issue,
@@ -31,6 +35,10 class Mailer < ActionMailer::Base
31 35
32 36 def issue_edit(journal)
33 37 issue = journal.journalized
38 redmine_headers 'Project' => issue.project.identifier,
39 'Issue-Id' => issue.id,
40 'Issue-Author' => issue.author.login
41 redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
34 42 recipients issue.recipients
35 43 # Watchers in cc
36 44 cc(issue.watcher_recipients - @recipients)
@@ -44,6 +52,7 class Mailer < ActionMailer::Base
44 52 end
45 53
46 54 def document_added(document)
55 redmine_headers 'Project' => document.project.identifier
47 56 recipients document.project.recipients
48 57 subject "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
49 58 body :document => document,
@@ -62,6 +71,7 class Mailer < ActionMailer::Base
62 71 added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
63 72 added_to = "#{l(:label_document)}: #{container.title}"
64 73 end
74 redmine_headers 'Project' => container.project.identifier
65 75 recipients container.project.recipients
66 76 subject "[#{container.project.name}] #{l(:label_attachment_new)}"
67 77 body :attachments => attachments,
@@ -70,6 +80,7 class Mailer < ActionMailer::Base
70 80 end
71 81
72 82 def news_added(news)
83 redmine_headers 'Project' => news.project.identifier
73 84 recipients news.project.recipients
74 85 subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}"
75 86 body :news => news,
@@ -77,6 +88,8 class Mailer < ActionMailer::Base
77 88 end
78 89
79 90 def message_posted(message, recipients)
91 redmine_headers 'Project' => message.project.identifier,
92 'Topic-Id' => (message.parent_id || message.id)
80 93 recipients(recipients)
81 94 subject "[#{message.board.project.name} - #{message.board.name}] #{message.subject}"
82 95 body :message => message,
@@ -139,6 +152,15 class Mailer < ActionMailer::Base
139 152 from Setting.mail_from
140 153 default_url_options[:host] = Setting.host_name
141 154 default_url_options[:protocol] = Setting.protocol
155 # Common headers
156 headers 'X-Mailer' => 'Redmine',
157 'X-Redmine-Host' => Setting.host_name,
158 'X-Redmine-Site' => Setting.app_title
159 end
160
161 # Appends a Redmine header field (name is prepended with 'X-Redmine-')
162 def redmine_headers(h)
163 h.each { |k,v| headers["X-Redmine-#{k}"] = v }
142 164 end
143 165
144 166 # Overrides the create_mail method
General Comments 0
You need to be logged in to leave comments. Login now