docbrown/app/mailers/devise_mailer.rb
Ben Halpern a079434397
Add new invitation params (#20074)
* Add new invitation fields

* SMTP enabled check

* Update spec/requests/api/v1/admin/users_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add devise_mailer spec

* Add devise_mailer spec

* Update spec/mailers/devise_mailer_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/mailers/devise_mailer_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/mailers/devise_mailer_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-13 13:01:39 -04:00

22 lines
774 B
Ruby

class DeviseMailer < Devise::Mailer
default reply_to: proc { ForemInstance.reply_to_email_address }
include Deliverable
before_action :use_settings_general_values
def use_settings_general_values
Devise.mailer_sender =
"#{Settings::Community.community_name} <#{ForemInstance.from_email_address}>"
ActionMailer::Base.default_url_options[:host] = Settings::General.app_domain
end
# rubocop:disable Style/OptionHash
def invitation_instructions(record, token, opts = {})
@message = opts[:custom_invite_message]
@footnote = opts[:custom_invite_footnote]
headers = { subject: opts[:custom_invite_subject].presence || "Invitation Instructions" }
super(record, token, opts.merge(headers))
end
# rubocop:enable Style/OptionHash
end