You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
830 B

  1. # frozen_string_literal: true
  2. class UserMailer < Devise::Mailer
  3. default from: ENV.fetch('SMTP_FROM_ADDRESS') { 'notifications@localhost' }
  4. layout 'mailer'
  5. def confirmation_instructions(user, token, _opts = {})
  6. @resource = user
  7. @token = token
  8. I18n.with_locale(@resource.locale || I18n.default_locale) do
  9. mail to: @resource.unconfirmed_email.blank? ? @resource.email : @resource.unconfirmed_email
  10. end
  11. end
  12. def reset_password_instructions(user, token, _opts = {})
  13. @resource = user
  14. @token = token
  15. I18n.with_locale(@resource.locale || I18n.default_locale) do
  16. mail to: @resource.email
  17. end
  18. end
  19. def password_change(user, _opts = {})
  20. @resource = user
  21. I18n.with_locale(@resource.locale || I18n.default_locale) do
  22. mail to: @resource.email
  23. end
  24. end
  25. end