From d8977d5f62c8b13d600ec36bf41304e42b52060f Mon Sep 17 00:00:00 2001 From: Bruno Prieto Date: Tue, 19 Dec 2023 06:04:29 -0300 Subject: [PATCH] Send plain text emails properly --- lib/mailchannels_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mailchannels_worker.rb b/lib/mailchannels_worker.rb index 935ca0c..8d026db 100644 --- a/lib/mailchannels_worker.rb +++ b/lib/mailchannels_worker.rb @@ -31,7 +31,7 @@ def deliver!(mail) bcc: mail.bcc_addresses.map { |address| { email: address.address, name: address.name }.compact }.presence, reply_to: (mail.header["Reply-To"]&.element&.addresses || []).map { |address| { email: address.address, name: address.name }.compact }.first }.compact], - content: mail.parts.map { |part| { type: part.content_type, value: part.decoded } } + content: mail.multipart? ? mail.parts.map { |part| { type: part.content_type, value: part.decoded } } : [{ type: mail.content_type, value: mail.decoded }] } send_email(body) end