diff --git a/Mail/Template/TransportBuilder.php b/Mail/Template/TransportBuilder.php index e4325f1..b6a1d65 100644 --- a/Mail/Template/TransportBuilder.php +++ b/Mail/Template/TransportBuilder.php @@ -107,27 +107,8 @@ protected function attachAttachmentsToBody() // @see https://magento.stackexchange.com/questions/292760/unable-to-add-attachment-in-email-after-upgrade-to-magento-2-3-3-version $mimeMessage = $this->mimeMessageFactory->create(); - /** @var Part $bodyPart */ - $bodyPart = $this->partFactory->create(['content' => $this->message->getBody()]); - // Cannot inherit through $this->message. Default is utf-8. - $bodyPart->setCharset('utf-8'); - - // Re-used from prepare message, can be removed in 2.3.3. - // Because they are using parts by default. These interface type logic can be removed. - $template = $this->getTemplate(); - switch ($template->getType()) { - case TemplateTypesInterface::TYPE_TEXT: - $bodyPart->setType(Mime::TYPE_TEXT); - $mimeMessage->setParts(array_merge([$bodyPart], $this->attachments)); - $this->message->setBodyText($mimeMessage); - break; - - case TemplateTypesInterface::TYPE_HTML: - $bodyPart->setType(Mime::TYPE_HTML); - $mimeMessage->setParts(array_merge([$bodyPart], $this->attachments)); - $this->message->setBodyHtml($mimeMessage); - break; - } + $mimeMessage->setParts(array_merge($this->message->getBody()->getParts(), $this->attachments)); + $this->message->setBody($mimeMessage); } } diff --git a/composer.json b/composer.json index 2cca4ed..e66fe8d 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,9 @@ ], "license": "MIT", "minimum-stability": "stable", + "require": { + "magento/framework": ">=102.0.0 <102.0.3" + }, "autoload": { "psr-4": { "WeProvide\\MailAttachment\\": ""