diff --git a/src/Transport/SparkPostApiTransport.php b/src/Transport/SparkPostApiTransport.php index 329369e..db4a31d 100644 --- a/src/Transport/SparkPostApiTransport.php +++ b/src/Transport/SparkPostApiTransport.php @@ -105,7 +105,9 @@ private function buildContent(Email $email, Envelope $envelope): array 'subject' => $email->getSubject(), 'text' => $email->getTextBody(), 'html' => $email->getHtmlBody(), - 'replyTo' => $email->getReplyTo(), + 'reply_to' => implode(',', array_map(function ($replyTo) { + return $replyTo->toString(); + }, $email->getReplyTo())), 'attachments' => $this->buildAttachments($email), ]); } diff --git a/tests/Transport/SparkPostApiTransportTest.php b/tests/Transport/SparkPostApiTransportTest.php index be5e884..9e95cd5 100644 --- a/tests/Transport/SparkPostApiTransportTest.php +++ b/tests/Transport/SparkPostApiTransportTest.php @@ -108,6 +108,36 @@ public function dataSend() $json = <<,no-reply2@mail.com,\"Fabien\" " + } +} +JSON; + yield [ + (new Email()) + ->from('sender@mail.com') + ->to('recipient@mail.com') + ->replyTo('no-reply@mail.com', new Address('gam6itko+no-reply@gmail.com', 'Gam6itko'), 'no-reply2@mail.com', new Address('fabien+no-reply@symfony.com', 'Fabien')) + ->subject('Test email') + ->text('Test email for you!'), + new Envelope(new Address('gam6itko@gmail.com'), [new Address('fabien@symfony.com')]), + $json, + ]; + + $json = <<