Skip to content

Commit

Permalink
Safety improvements for email sending
Browse files Browse the repository at this point in the history
Added return statements to email sending code to avoid exceptions on errors. This ensures attempted message sends will not cause further failures if an error occurs.
  • Loading branch information
delano committed Apr 30, 2024
1 parent a945d8d commit c1dd317
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/onetime/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ def send_email to_address, subject, content
rescue Net::SMTPFatalError => ex
OT.info "> [send-exception-smtperror] #{obscured_address}"
OT.ld "#{ex.class} #{ex.message}\n#{ex.backtrace}"
return
rescue => ex
OT.info "> [send-exception-sending] #{obscured_address}"
OT.ld "#{ex.class} #{ex.message}\n#{ex.backtrace}"
return
end

# Log the details
Expand Down

0 comments on commit c1dd317

Please sign in to comment.