Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] SesTransport: use correct Tags argument #42390

Merged
merged 1 commit into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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('[email protected]');
$message->to('[email protected]');
$message->bcc('[email protected]');
$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'] === '[email protected]' &&
$arg['Destinations'] === ['[email protected]', '[email protected]'] &&
$arg['Tags'] === [['Name' => 'FooTag', 'Value' => 'TagValue']];
}))
->andReturn($sesResult);

(new SesTransport($client))->send($message);
Expand Down