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`
|
|
|
|
|
layout 'mailers/layout'
|
2018-06-08 19:41:34 +02:00
|
|
|
|
|
2020-02-20 11:39:33 +01:00
|
|
|
|
# Don’t retry to send a message if the server rejects the recipient address
|
|
|
|
|
rescue_from Net::SMTPSyntaxError do |_error|
|
|
|
|
|
message.perform_deliveries = false
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-13 15:21:12 +02:00
|
|
|
|
rescue_from Net::SMTPServerBusy do |error|
|
2020-09-24 15:12:21 +02:00
|
|
|
|
if /unexpected recipients/.match?(error.message)
|
2020-07-13 15:21:12 +02:00
|
|
|
|
message.perform_deliveries = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2018-06-08 19:41:34 +02:00
|
|
|
|
def template_paths
|
|
|
|
|
['devise_mailer']
|
|
|
|
|
end
|
2019-09-10 13:29:06 +02:00
|
|
|
|
|
|
|
|
|
def confirmation_instructions(record, token, opts = {})
|
|
|
|
|
opts[:from] = 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]
|
2019-09-10 13:29:06 +02:00
|
|
|
|
super
|
|
|
|
|
end
|
2018-05-14 14:21:03 +02:00
|
|
|
|
end
|