diff --git a/Tests/Transport/MandrillHttpTransportTest.php b/Tests/Transport/MandrillHttpTransportTest.php index cfdc30b..22d0a8c 100644 --- a/Tests/Transport/MandrillHttpTransportTest.php +++ b/Tests/Transport/MandrillHttpTransportTest.php @@ -57,8 +57,9 @@ public function testSend() $body = json_decode($options['body'], true); $message = $body['raw_message']; $this->assertSame('KEY', $body['key']); + $this->assertSame('Fabien', $body['from_name']); + $this->assertSame('fabpot@symfony.com', $body['from_email']); $this->assertSame('saif.gmati@symfony.com', $body['to'][0]); - $this->assertSame('Fabien ', $body['from_email']); $this->assertStringContainsString('Subject: Hello!', $message); $this->assertStringContainsString('To: Saif Eddin ', $message); diff --git a/Transport/MandrillHttpTransport.php b/Transport/MandrillHttpTransport.php index 0537e6d..1c3846d 100644 --- a/Transport/MandrillHttpTransport.php +++ b/Transport/MandrillHttpTransport.php @@ -49,7 +49,8 @@ protected function doSendHttp(SentMessage $message): ResponseInterface 'to' => array_map(function (Address $recipient): string { return $recipient->getAddress(); }, $envelope->getRecipients()), - 'from_email' => $envelope->getSender()->toString(), + 'from_email' => $envelope->getSender()->getAddress(), + 'from_name' => $envelope->getSender()->getName(), 'raw_message' => $message->toString(), ], ]);