Commit 3b8baecd authored by Daniel Gerhardt's avatar Daniel Gerhardt

Fix mail address header formatting for DeviseMailer

`DeviseMailer` did not correctly handle display names set via
`Gitlab.config.gitlab.email_display_name` if they contained spaces or
special characters. It has been adjusted to handle addresses in the same
way `BaseMailer` does.
parent 46bbfed8
# frozen_string_literal: true
class DeviseMailer < Devise::Mailer
default from: "#{Gitlab.config.gitlab.email_display_name} <#{Gitlab.config.gitlab.email_from}>"
default reply_to: Gitlab.config.gitlab.email_reply_to
default from: proc { default_sender_address.format }
default reply_to: proc { default_reply_to_address.format }
layout 'mailer/devise'
......@@ -16,4 +16,16 @@ class DeviseMailer < Devise::Mailer
subject.join(' | ')
end
def default_sender_address
address = Mail::Address.new(Gitlab.config.gitlab.email_from)
address.display_name = Gitlab.config.gitlab.email_display_name
address
end
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
end
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