-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Open
Description
Hello,
I am trying to do the following so that the mail header To field contains a user's name as well as email address.
class ApplicationDeviseMailer < Devise::Mailer
default to: -> { computed_to }
private
def computed_to
ApplicationMailer.email_address_with_name(resource.email, resource.name)
end
endHowever, there is not an option to transform the To field (only From and Reply-To):
devise/lib/devise/mailers/helpers.rb
Lines 31 to 48 in fec67f9
| def headers_for(action, opts) | |
| headers = { | |
| subject: subject_for(action), | |
| to: resource.email, | |
| from: mailer_sender(devise_mapping), | |
| reply_to: mailer_sender(devise_mapping), | |
| template_path: template_paths, | |
| template_name: action | |
| } | |
| # Give priority to the mailer's default if they exists. | |
| headers.delete(:from) if default_params[:from] | |
| headers.delete(:reply_to) if default_params[:reply_to] | |
| headers.merge!(opts) | |
| @email = headers[:to] | |
| headers | |
| end |
Metadata
Metadata
Assignees
Labels
No labels