diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-19 20:17:32 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-19 20:17:32 +0300 |
commit | 6b31827a41b3a057569d8476f9e8d5a22980cc16 (patch) | |
tree | a625e33a49505c39d66fb2531b81007c6089c42e | |
parent | 4f34d363a532613df60f3e566644c082ed3fa395 (diff) |
Include display name with reply to address.
-rw-r--r-- | app/mailers/notify.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index e893009c728..8a386de9a39 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -17,7 +17,7 @@ class Notify < ActionMailer::Base helper_method :current_user, :can? default from: Proc.new { default_sender_address.format } - default reply_to: Gitlab.config.gitlab.email_reply_to + default reply_to: Proc.new { default_reply_to_address.format } # Just send email with 2 seconds delay def self.delay @@ -66,6 +66,13 @@ class Notify < ActionMailer::Base address end + # The default email address to send emails from + def default_reply_to_address + address = Mail::Address.new(Gitlab.config.gitlab.email_reply_to) + address.display_name = Gitlab.config.gitlab.email_display_name + address + end + def can_send_from_user_email?(sender) sender_domain = sender.email.split("@").last self.class.allowed_email_domains.include?(sender_domain) @@ -140,7 +147,13 @@ class Notify < ActionMailer::Base if reply_key headers['X-GitLab-Reply-Key'] = reply_key - headers['Reply-To'] = Gitlab::ReplyByEmail.reply_address(reply_key) + + address = Mail::Address.new(Gitlab::ReplyByEmail.reply_address(reply_key)) + address.display_name = @project.name_with_namespace + + headers['Reply-To'] = address + + @reply_by_email = true end mail(headers) |