From 8f23e16208d606f0e367b83755833a608cf8d8ea Mon Sep 17 00:00:00 2001 From: Richard Lynch Date: Tue, 12 Nov 2024 09:59:33 +0000 Subject: [PATCH] Log emails in dev Useful for grabbing magic links etc --- app/mailers/claim_mailer.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/mailers/claim_mailer.rb b/app/mailers/claim_mailer.rb index d2dc9a4e13..6987f17ab4 100644 --- a/app/mailers/claim_mailer.rb +++ b/app/mailers/claim_mailer.rb @@ -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 @@ -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,