Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log emails in dev #3389

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will actually prevent the email from sending though, which is useful for debugging. do we not want to do this on top of the default behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never used that but will let it send emails through


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