Skip to content

Commit d2429ab

Browse files
authored
SesTransport: use correct Tags argument. (#42390)
1 parent 071af6c commit d2429ab

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/Illuminate/Mail/Transport/SesTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function doSend(SentMessage $message): void
5151
if ($message->getOriginalMessage() instanceof Message) {
5252
foreach ($message->getOriginalMessage()->getHeaders()->all() as $header) {
5353
if ($header instanceof MetadataHeader) {
54-
$options['EmailTags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()];
54+
$options['Tags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()];
5555
}
5656
}
5757
}

tests/Mail/MailSesTransportTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\View\Factory;
1111
use Mockery as m;
1212
use PHPUnit\Framework\TestCase;
13+
use Symfony\Component\Mailer\Header\MetadataHeader;
1314
use Symfony\Component\Mime\Email;
1415

1516
class MailSesTransportTest extends TestCase
@@ -55,6 +56,7 @@ public function testSend()
5556
$message->sender('myself@example.com');
5657
$message->to('me@example.com');
5758
$message->bcc('you@example.com');
59+
$message->getHeaders()->add(new MetadataHeader('FooTag', 'TagValue'));
5860

5961
$client = m::mock(SesClient::class);
6062
$sesResult = m::mock();
@@ -63,6 +65,11 @@ public function testSend()
6365
->once()
6466
->andReturn('ses-message-id');
6567
$client->shouldReceive('sendRawEmail')->once()
68+
->with(m::on(function ($arg) {
69+
return $arg['Source'] === 'myself@example.com' &&
70+
$arg['Destinations'] === ['me@example.com', 'you@example.com'] &&
71+
$arg['Tags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']];
72+
}))
6673
->andReturn($sesResult);
6774

6875
(new SesTransport($client))->send($message);

0 commit comments

Comments
 (0)