From 6a7d3efe927f3e10f7915009ffb66c5c56442586 Mon Sep 17 00:00:00 2001 From: Mischa Braam Date: Mon, 7 Sep 2020 08:51:49 +0200 Subject: [PATCH] Fix mimetype --- Mail/Template/TransportBuilder.php | 12 +++++++----- composer.json | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Mail/Template/TransportBuilder.php b/Mail/Template/TransportBuilder.php index 37115e4..0e1ee6e 100644 --- a/Mail/Template/TransportBuilder.php +++ b/Mail/Template/TransportBuilder.php @@ -314,14 +314,14 @@ protected function getTemplate() protected function prepareMessage() { $template = $this->getTemplate(); - $content = $template->processTemplate(); + $mimeType = null; switch ($template->getType()) { case TemplateTypesInterface::TYPE_TEXT: - $part['type'] = MimeInterface::TYPE_TEXT; + $mimeType = MimeInterface::TYPE_TEXT; break; case TemplateTypesInterface::TYPE_HTML: - $part['type'] = MimeInterface::TYPE_HTML; + $mimeType = MimeInterface::TYPE_HTML; break; default: @@ -329,8 +329,10 @@ protected function prepareMessage() new Phrase('Unknown template type') ); } - $mimePart = $this->mimePartInterfaceFactory->create(['content' => $content]); - $parts = count($this->attachments) ? array_merge([$mimePart], $this->attachments) : [$mimePart]; + + $content = $template->processTemplate(); + $mimePart = $this->mimePartInterfaceFactory->create(['content' => $content, 'type' => $mimeType]); + $parts = count($this->attachments) ? array_merge([$mimePart], $this->attachments) : [$mimePart]; $this->messageData['body'] = $this->mimeMessageInterfaceFactory->create( ['parts' => $parts] ); diff --git a/composer.json b/composer.json index c8ffe96..8ba86f7 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "weprovide/magento2-module-mailattachment", "description": "Extends TransportBuilder with attachment functionality", "type": "magento2-module", - "version": "2.1.3", + "version": "2.1.4", "authors": [ { "email": "sander@weprovide.com",