[Mailer] Support reply-to in SesApiAsyncAwsTransport

Enable sending `SendEmailRequest`s with reply-to addresses with
`SesApiAsyncAwsTransport`.
This commit is contained in:
Clara van Miert 2020-08-20 19:02:43 +02:00
parent 5a9180370e
commit 163e961b44
No known key found for this signature in database
GPG Key ID: A91CFBBDCBBA4509
2 changed files with 6 additions and 1 deletions

View File

@ -68,6 +68,7 @@ class SesApiAsyncAwsTransportTest extends TestCase
$this->assertSame('Fabien <fabpot@symfony.com>', $content['FromEmailAddress']);
$this->assertSame('Hello There!', $content['Content']['Simple']['Body']['Text']['Data']);
$this->assertSame('<b>Hello There!</b>', $content['Content']['Simple']['Body']['Html']['Data']);
$this->assertSame(['replyto-1@example.com', 'replyto-2@example.com'], $content['ReplyToAddresses']);
$json = '{"MessageId": "foobar"}';
@ -83,7 +84,8 @@ class SesApiAsyncAwsTransportTest extends TestCase
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
->from(new Address('fabpot@symfony.com', 'Fabien'))
->text('Hello There!')
->html('<b>Hello There!</b>');
->html('<b>Hello There!</b>')
->replyTo(new Address('replyto-1@example.com'), new Address('replyto-2@example.com'));
$message = $transport->send($mail);

View File

@ -86,6 +86,9 @@ class SesApiAsyncAwsTransport extends SesHttpAsyncAwsTransport
'Charset' => $email->getHtmlCharset(),
]);
}
if ($emails = $email->getReplyTo()) {
$request['ReplyToAddresses'] = $this->stringifyAddresses($emails);
}
return new SendEmailRequest($request);
}