From 064fe247feb11fa2f280b7e4312c4c2859dcf086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Perrin?= Date: Tue, 15 Oct 2019 18:00:19 -0500 Subject: [PATCH] [Mailer] Fix attachments and embedded images for Mailchimp API --- .../Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php | 5 +++-- src/Symfony/Component/Mime/Part/TextPart.php | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php index 9217eaa49f46b..7e5f93b61ec88 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Http/Api/MandrillTransport.php @@ -70,14 +70,15 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array $disposition = $headers->getHeaderBody('Content-Disposition'); $att = [ + 'name' => $attachment->getName(), 'content' => $attachment->bodyToString(), 'type' => $headers->get('Content-Type')->getBody(), ]; if ('inline' === $disposition) { - $payload['images'][] = $att; + $payload['message']['images'][] = $att; } else { - $payload['attachments'][] = $att; + $payload['message']['attachments'][] = $att; } } diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Component/Mime/Part/TextPart.php index 6a0418531525d..5709f23c63b93 100644 --- a/src/Symfony/Component/Mime/Part/TextPart.php +++ b/src/Symfony/Component/Mime/Part/TextPart.php @@ -69,6 +69,11 @@ public function getMediaSubtype(): string return $this->subtype; } + public function getName(): string + { + return $this->name; + } + /** * @param string $disposition one of attachment, inline, or form-data *