2018-11-20 11:57:51 +01:00
|
|
|
# Preview all emails at http://localhost:3000/rails/mailers/devise_user_mailer
|
2018-05-14 14:21:03 +02:00
|
|
|
class DeviseUserMailer < Devise::Mailer
|
|
|
|
helper :application # gives access to all helpers defined within `application_helper`.
|
2021-04-22 12:34:41 +02:00
|
|
|
helper MailerHelper
|
2018-05-14 14:21:03 +02:00
|
|
|
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
|
2024-03-26 20:00:54 +01:00
|
|
|
include MailerDefaultsConfigurableConcern
|
2023-01-16 11:34:36 +01:00
|
|
|
include MailerDolistConcern
|
2023-01-10 15:36:58 +01:00
|
|
|
include MailerMonitoringConcern
|
2023-01-23 14:56:05 +01:00
|
|
|
include BalancedDeliveryConcern
|
2023-10-18 07:10:26 +02:00
|
|
|
include PriorityDeliveryConcern
|
|
|
|
|
2018-05-14 14:21:03 +02:00
|
|
|
layout 'mailers/layout'
|
2024-03-25 20:12:12 +01:00
|
|
|
default from: "#{APPLICATION_NAME} <#{CONTACT_EMAIL}>"
|
2018-06-08 19:41:34 +02:00
|
|
|
|
|
|
|
def template_paths
|
|
|
|
['devise_mailer']
|
|
|
|
end
|
2019-09-10 13:29:06 +02:00
|
|
|
|
2024-03-25 20:12:12 +01:00
|
|
|
# Note: this devise hook (like any callback) is called *after* the action,
|
|
|
|
# because we use mailers with Mailer.action_name() syntax
|
|
|
|
# instead of parameterized Mailer.with().action_name.
|
|
|
|
# So any action using Current must manually call `configure_defaults_for_user`
|
|
|
|
def initialize_from_record(record)
|
|
|
|
configure_defaults_for_user(record)
|
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
2019-09-10 13:29:06 +02:00
|
|
|
def confirmation_instructions(record, token, opts = {})
|
2024-03-25 19:13:09 +01:00
|
|
|
configure_defaults_for_user(record)
|
|
|
|
|
|
|
|
opts[:from] = Current.no_reply_email
|
|
|
|
opts[:reply_to] = Current.no_reply_email
|
2020-02-25 15:12:09 +01:00
|
|
|
@procedure = opts[:procedure_after_confirmation] || nil
|
2023-01-03 14:46:10 +01:00
|
|
|
@prefill_token = opts[:prefill_token]
|
2024-03-28 12:30:31 +01:00
|
|
|
|
|
|
|
I18n.with_locale(record.locale) do
|
|
|
|
super
|
|
|
|
end
|
2019-09-10 13:29:06 +02:00
|
|
|
end
|
2023-01-11 09:44:39 +01:00
|
|
|
|
2023-10-18 07:10:26 +02:00
|
|
|
def self.critical_email?(action_name)
|
2023-01-23 14:56:05 +01:00
|
|
|
true
|
2023-01-11 09:44:39 +01:00
|
|
|
end
|
2018-05-14 14:21:03 +02:00
|
|
|
end
|