From 716638bec3f7c286abdc9e63464d4040281408c1 Mon Sep 17 00:00:00 2001 From: Tietew Date: Sun, 15 May 2022 22:33:24 +0900 Subject: [PATCH] SesTransport: use correct `Tags` argument. --- src/Illuminate/Mail/Transport/SesTransport.php | 2 +- tests/Mail/MailSesTransportTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Mail/Transport/SesTransport.php b/src/Illuminate/Mail/Transport/SesTransport.php index 38eb045d51ed..2890b4c0cddd 100644 --- a/src/Illuminate/Mail/Transport/SesTransport.php +++ b/src/Illuminate/Mail/Transport/SesTransport.php @@ -51,7 +51,7 @@ protected function doSend(SentMessage $message): void if ($message->getOriginalMessage() instanceof Message) { foreach ($message->getOriginalMessage()->getHeaders()->all() as $header) { if ($header instanceof MetadataHeader) { - $options['EmailTags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()]; + $options['Tags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()]; } } } diff --git a/tests/Mail/MailSesTransportTest.php b/tests/Mail/MailSesTransportTest.php index a2f5a929f390..74598c6b61c8 100755 --- a/tests/Mail/MailSesTransportTest.php +++ b/tests/Mail/MailSesTransportTest.php @@ -10,6 +10,7 @@ use Illuminate\View\Factory; use Mockery as m; use PHPUnit\Framework\TestCase; +use Symfony\Component\Mailer\Header\MetadataHeader; use Symfony\Component\Mime\Email; class MailSesTransportTest extends TestCase @@ -55,6 +56,7 @@ public function testSend() $message->sender('myself@example.com'); $message->to('me@example.com'); $message->bcc('you@example.com'); + $message->getHeaders()->add(new MetadataHeader('FooTag', 'TagValue')); $client = m::mock(SesClient::class); $sesResult = m::mock(); @@ -63,6 +65,11 @@ public function testSend() ->once() ->andReturn('ses-message-id'); $client->shouldReceive('sendRawEmail')->once() + ->with(m::on(function ($arg) { + return $arg['Source'] === 'myself@example.com' && + $arg['Destinations'] === ['me@example.com', 'you@example.com'] && + $arg['Tags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']]; + })) ->andReturn($sesResult); (new SesTransport($client))->send($message);