From fcd2f857b9d4c93230c3fe8d05af7e364d80b2bf Mon Sep 17 00:00:00 2001 From: Shujat Khalid Date: Thu, 15 Aug 2024 14:46:34 +0100 Subject: [PATCH] Save email to MailDeliveryFailure --- app/mailers/application_mailer.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 630698da8..56881fd96 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -15,9 +15,10 @@ class ApplicationMailer < Mail::Notify::Mailer # # @see https://github.com/rails/rails/issues/39018 if respond_to?(:headers) - binding.break - email = Email.find(headers['email-log-id'].to_s) - email.update!(delivery_status: 'notify_error') + recipient_email = headers['To'].value + MailDeliveryFailure.create!( + recipient_email: recipient_email + ) end raise