redmine-1.0.1-mail_from_pattern.patch

Patch for mail_from pattern - Daniel M, 2010-09-07 20:41

Download (5.41 KB)

View differences:

./app/models/mailer.rb 2010-09-04 19:56:32.000000000 +0200
40 40
                    'Issue-Id' => issue.id,
41 41
                    'Issue-Author' => issue.author.login
42 42
    redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
43
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", issue.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
43 44
    message_id issue
44 45
    recipients issue.recipients
45 46
    cc(issue.watcher_recipients - @recipients)
......
60 61
                    'Issue-Id' => issue.id,
61 62
                    'Issue-Author' => issue.author.login
62 63
    redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
64
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", issue.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
63 65
    message_id journal
64 66
    references issue
65 67
    @author = journal.user
......
94 96
  #   Mailer.deliver_document_added(document) => sends an email to the document's project recipients
95 97
  def document_added(document)
96 98
    redmine_headers 'Project' => document.project.identifier
99
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", document.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
97 100
    recipients document.recipients
98 101
    subject "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
99 102
    body :document => document,
......
125 128
      recipients container.recipients
126 129
    end
127 130
    redmine_headers 'Project' => container.project.identifier
131
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", container.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
128 132
    subject "[#{container.project.name}] #{l(:label_attachment_new)}"
129 133
    body :attachments => attachments,
130 134
         :added_to => added_to,
......
139 143
  #   Mailer.deliver_news_added(news) => sends an email to the news' project recipients
140 144
  def news_added(news)
141 145
    redmine_headers 'Project' => news.project.identifier
146
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", news.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
142 147
    message_id news
143 148
    recipients news.recipients
144 149
    subject "[#{news.project.name}] #{l(:label_news)}: #{news.title}"
......
155 160
  def message_posted(message)
156 161
    redmine_headers 'Project' => message.project.identifier,
157 162
                    'Topic-Id' => (message.parent_id || message.id)
163
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", message.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
158 164
    message_id message
159 165
    references message.parent unless message.parent.nil?
160 166
    recipients(message.recipients)
......
173 179
  def wiki_content_added(wiki_content)
174 180
    redmine_headers 'Project' => wiki_content.project.identifier,
175 181
                    'Wiki-Page-Id' => wiki_content.page.id
182
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", wiki_content.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
176 183
    message_id wiki_content
177 184
    recipients wiki_content.recipients
178 185
    cc(wiki_content.page.wiki.watcher_recipients - recipients)
......
190 197
  def wiki_content_updated(wiki_content)
191 198
    redmine_headers 'Project' => wiki_content.project.identifier,
192 199
                    'Wiki-Page-Id' => wiki_content.page.id
200
    from Setting.mail_from_pattern.to_s.gsub("%%projectid%%", wiki_content.project.identifier) unless Setting.mail_from_pattern.to_s.empty?
193 201
    message_id wiki_content
194 202
    recipients wiki_content.recipients
195 203
    cc(wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients)
./app/views/settings/_notifications.rhtml 2010-09-04 19:43:33.000000000 +0200
4 4
<div class="box tabular settings">
5 5
<p><%= setting_text_field :mail_from, :size => 60 %></p>
6 6

  
7
<p><%= setting_text_field :mail_from_pattern, :size => 60 %></p>
8

  
7 9
<p><%= setting_check_box :bcc_recipients %></p>
8 10

  
9 11
<p><%= setting_check_box :plain_text_mail %></p>
./config/locales/en.yml 2010-09-04 19:45:46.000000000 +0200
303 303
  setting_attachment_max_size: Attachment max. size
304 304
  setting_issues_export_limit: Issues export limit
305 305
  setting_mail_from: Emission email address
306
  setting_mail_from_pattern: Emission email address pattern
306 307
  setting_bcc_recipients: Blind carbon copy recipients (bcc)
307 308
  setting_plain_text_mail: Plain text mail (no HTML)
308 309
  setting_host_name: Host name and path
./config/settings.yml 2010-09-04 19:55:23.000000000 +0200
47 47
  default: '25,50,100'
48 48
mail_from:
49 49
  default: redmine@example.net
50
# pattern for From address
51
# - can replace '%%projectid%%' with project ID
52
# ex: %%projectid%%-support@example.net"
53
mail_from_pattern:
54
  default: ""
50 55
bcc_recipients:
51 56
  default: 1
52 57
plain_text_mail: