diff --git a/src/Symfony/Component/Mailer/Bridge/Scaleway/Tests/Transport/ScalewayApiTransportTest.php b/src/Symfony/Component/Mailer/Bridge/Scaleway/Tests/Transport/ScalewayApiTransportTest.php index 0d91d002cd21..f31e041ea73d 100644 --- a/src/Symfony/Component/Mailer/Bridge/Scaleway/Tests/Transport/ScalewayApiTransportTest.php +++ b/src/Symfony/Component/Mailer/Bridge/Scaleway/Tests/Transport/ScalewayApiTransportTest.php @@ -69,6 +69,8 @@ public function testSend() $this->assertSame('attachment.txt', $body['attachments'][0]['name']); $this->assertSame('text/plain', $body['attachments'][0]['type']); $this->assertSame(base64_encode('some attachment'), $body['attachments'][0]['content']); + $this->assertSame('Reply-To', $body['additional_headers'][0]['key']); + $this->assertStringContainsString('foo@bar.fr', $body['additional_headers'][0]['value']); return new JsonMockResponse(['emails' => [['message_id' => 'foobar']]], [ 'http_code' => 200, @@ -81,6 +83,7 @@ public function testSend() $mail->subject('Hello!') ->to(new Address('saif.gmati@symfony.com', 'Saif Eddin')) ->from(new Address('fabpot@symfony.com', 'Fabien')) + ->replyTo(new Address('foo@bar.fr', 'Foo')) ->text('Hello There!') ->addPart(new DataPart('some attachment', 'attachment.txt', 'text/plain')); diff --git a/src/Symfony/Component/Mailer/Bridge/Scaleway/Transport/ScalewayApiTransport.php b/src/Symfony/Component/Mailer/Bridge/Scaleway/Transport/ScalewayApiTransport.php index 60cb198d3b5a..3c277abb6e71 100644 --- a/src/Symfony/Component/Mailer/Bridge/Scaleway/Transport/ScalewayApiTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Scaleway/Transport/ScalewayApiTransport.php @@ -101,6 +101,9 @@ private function getPayload(Email $email, Envelope $envelope): array if ($attachements = $this->prepareAttachments($email)) { $payload['attachments'] = $attachements; } + if ($headers = $this->getCustomHeaders($email)) { + $payload['additional_headers'] = $headers; + } return $payload; } @@ -122,6 +125,24 @@ private function prepareAttachments(Email $email): array return $attachments; } + private function getCustomHeaders(Email $email): array + { + $headers = []; + $headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender']; + foreach ($email->getHeaders()->all() as $name => $header) { + if (\in_array($name, $headersToBypass, true)) { + continue; + } + + $headers[] = [ + 'key' => $header->getName(), + 'value' => $header->getBodyAsString(), + ]; + } + + return $headers; + } + private function formatAddress(Address $address): array { $array = ['email' => $address->getAddress()]; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy