Files
docuseal/app/mailers/template_mailer.rb
T
2026-10-01 08:57:19 +03:00

25 lines
740 B
Ruby

# frozen_string_literal: true
class TemplateMailer < ApplicationMailer
def otp_verification_email(template, email:)
@current_account = template.account
@template = template
@otp_code = OtpChallenges.generate([email.downcase.squish, template.slug].join(':'), purpose: 'form_email_2fa')
assign_message_metadata('otp_verification_email', template)
from =
if Docuseal.multitenant? &&
AccountConfig.exists?(account_id: template.account_id, key: 'custom_otp_email', value: true)
put_metadata('from_user_id' => template.author_id)
template.author.friendly_name
else
default_params[:from]
end
mail(to: email, from:, subject: I18n.t('email_verification'))
end
end