diff --git a/lib/email_log_interceptor.rb b/lib/email_log_interceptor.rb index c42eecdbd24..12c23602a8a 100644 --- a/lib/email_log_interceptor.rb +++ b/lib/email_log_interceptor.rb @@ -13,8 +13,8 @@ def self.delivering_email(mail) body: mail.body.encoded, notify_reference:, application_form_id: mail.header['application_form_id']&.value, - mailer: mail.header['rails_mailer'].value, - mail_template: mail.header['rails_mail_template'].value, + mailer: mail.header['rails-mailer']&.first&.value, + mail_template: mail.header['rails-mail-template']&.first&.value, delivery_status: mail.perform_deliveries ? 'pending' : 'skipped', ) diff --git a/spec/services/send_new_application_email_to_provider_spec.rb b/spec/services/send_new_application_email_to_provider_spec.rb index 9612cee8de5..c1d427d86b5 100644 --- a/spec/services/send_new_application_email_to_provider_spec.rb +++ b/spec/services/send_new_application_email_to_provider_spec.rb @@ -18,8 +18,8 @@ training_provider_email = ActionMailer::Base.deliveries.find { |e| e.header['to'].value == training_provider_user.email_address } ratifying_provider_email = ActionMailer::Base.deliveries.find { |e| e.header['to'].value == ratifying_provider_user.email_address } - expect(training_provider_email['rails-mail-template'].value).to eq('application_submitted') - expect(ratifying_provider_email['rails-mail-template'].value).to eq('application_submitted') + expect(training_provider_email['rails-mail-template'].first.value).to eq('application_submitted') + expect(ratifying_provider_email['rails-mail-template'].first.value).to eq('application_submitted') end it 'sends a different email when the candidate supplied safeguarding information' do @@ -32,7 +32,7 @@ described_class.new(application_choice: choice).call - email = ActionMailer::Base.deliveries.find { |e| e.header['rails_mail_template'].value == 'application_submitted_with_safeguarding_issues' } + email = ActionMailer::Base.deliveries.find { |e| e.header['rails-mail-template'].first.value == 'application_submitted_with_safeguarding_issues' } expect(email).to be_present end