summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-02-15 23:52:30 +0000
committerGo MAEDA <maeda@farend.jp>2019-02-15 23:52:30 +0000
commit21e503fc7100049131c41d27a33ec62094135263 (patch)
tree2eddf9283f1287490db8401e4c6fcceb37496d85 /app
parent6a639cdf0fd331c17c63a0e777dea64239e4eb3c (diff)
downloadredmine-21e503fc7100049131c41d27a33ec62094135263.tar.gz
redmine-21e503fc7100049131c41d27a33ec62094135263.zip
Show author's name in the From field of email notifications (#5913).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17870 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/mailer.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 492ca976d..dc155648e 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -615,13 +615,21 @@ class Mailer < ActionMailer::Base
end
def mail(headers={}, &block)
+ # Add a display name to the From field if Setting.mail_from does not
+ # include it
+ mail_from = Mail::Address.new(Setting.mail_from)
+ if mail_from.display_name.blank? && mail_from.comments.blank?
+ mail_from.display_name =
+ (@author && @author.logged?) ? @author.name : Setting.app_title
+ end
+
headers.reverse_merge! 'X-Mailer' => 'Redmine',
'X-Redmine-Host' => Setting.host_name,
'X-Redmine-Site' => Setting.app_title,
'X-Auto-Response-Suppress' => 'All',
'Auto-Submitted' => 'auto-generated',
- 'From' => Setting.mail_from,
- 'List-Id' => "<#{Setting.mail_from.to_s.tr('@', '.')}>"
+ 'From' => mail_from.format,
+ 'List-Id' => "<#{mail_from.address.to_s.tr('@', '.')}>"
# Replaces users with their email addresses
[:to, :cc, :bcc].each do |key|