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
end
However, there is not an option to transform the To field (only From and Reply-To):
|
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 |
Hello,
I am trying to do the following so that the mail header
Tofield contains a user's name as well as email address.However, there is not an option to transform the
Tofield (onlyFromandReply-To):devise/lib/devise/mailers/helpers.rb
Lines 31 to 48 in fec67f9