Skip to content

Commit

Permalink
Merge pull request #3389 from DFE-Digital/log-emails-in-dev
Browse files Browse the repository at this point in the history
Log emails in dev
  • Loading branch information
rjlynch authored Nov 15, 2024
2 parents f0eb91c + 8f23e16 commit f0d5415
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/mailers/claim_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ def email_verification(claim, one_time_password)
validity_duration: one_time_password_validity_duration
}

if Rails.env.development?
Rails.logger.info("\n\nEmail verification code: #{@one_time_password}\n")
end

send_mail(OTP_EMAIL_NOTIFY_TEMPLATE_ID, personalisation)
end

Expand Down Expand Up @@ -215,6 +211,18 @@ def template_ids(claim)
end

def send_mail(template_id, personalisation)
if Rails.env.development?
Rails.logger.info(
[
"\n",
"Sending email to: #{@claim.email_address}",
"Template ID: #{template_id}",
"Subject: #{@subject}",
"Personalisation: \n#{personalisation.pretty_inspect}"
].join("\n")
)
end

template_mail(
template_id,
to: @claim.email_address,
Expand Down

0 comments on commit f0d5415

Please sign in to comment.