Skip to content

Commit

Permalink
SesTransport: use correct Tags argument. (#42390)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tietew committed May 16, 2022
1 parent 071af6c commit d2429ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Mail/Transport/SesTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()];
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Mail/MailSesTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit d2429ab

Please sign in to comment.