diff --git a/lib/mail/resend_provider.rb b/lib/mail/resend_provider.rb index f151abfcf..dfc95b4c0 100644 --- a/lib/mail/resend_provider.rb +++ b/lib/mail/resend_provider.rb @@ -6,9 +6,9 @@ module Mail # rubocop:disable Style/ClassAndModuleChildren def deliver!(mail) Resend::Emails.send( - from: mail.smtp_envelope_from, - to: mail.smtp_envelope_to, - subject: mail.subject, + from: mail.header[:from].to_s, + to: mail.header[:to].to_s, + subject: mail.header[:subject].to_s, html: mail.decoded, text: sanitize_html(mail.decoded) ) diff --git a/spec/lib/mail/resend_provider_spec.rb b/spec/lib/mail/resend_provider_spec.rb index fc4d126b0..16cefea51 100644 --- a/spec/lib/mail/resend_provider_spec.rb +++ b/spec/lib/mail/resend_provider_spec.rb @@ -3,11 +3,14 @@ require 'rails_helper' describe Mail::ResendProvider do let(:provider) { described_class.new({}) } let(:mail) do - instance_double(Mail::Message, - smtp_envelope_from: 'sender@example.com', - smtp_envelope_to: ['receiver@example.com'], - subject: 'Test Email', - decoded: '
This is a test email message.
') + Mail::Message.new( + headers: { + from: 'SenderThis is a test email message.
' + ) end describe '#deliver!' do @@ -15,8 +18,8 @@ describe Mail::ResendProvider do response = instance_double(HTTParty::Response, success?: true) allow(Resend::Emails).to receive(:send) .with( - from: 'sender@example.com', - to: ['receiver@example.com'], + from: 'SenderThis is a test email message.
', text: 'This is a test email message.' @@ -32,8 +35,8 @@ describe Mail::ResendProvider do it 'raises a DeliveryError with the error message' do allow(Resend::Emails).to receive(:send) .with( - from: 'sender@example.com', - to: ['receiver@example.com'], + from: 'SenderThis is a test email message.
', text: 'This is a test email message.'