[Mailer] Support Return-Path in SesApiAsyncAwsTransport

Enable sending `SendEmailRequest`s with a `Return-Path` configured in
`SesApiAsyncAwsTransport`.
This commit is contained in:
Clara van Miert 2020-08-20 19:19:12 +02:00
parent 0611b6331c
commit 61754cb891
No known key found for this signature in database
GPG Key ID: A91CFBBDCBBA4509
2 changed files with 6 additions and 1 deletions

View File

@ -69,6 +69,7 @@ class SesApiAsyncAwsTransportTest extends TestCase
$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']);
$this->assertSame('bounces@example.com', $content['FeedbackForwardingEmailAddress']);
$json = '{"MessageId": "foobar"}';
@ -85,7 +86,8 @@ class SesApiAsyncAwsTransportTest extends TestCase
->from(new Address('fabpot@symfony.com', 'Fabien'))
->text('Hello There!')
->html('<b>Hello There!</b>')
->replyTo(new Address('replyto-1@example.com'), new Address('replyto-2@example.com'));
->replyTo(new Address('replyto-1@example.com'), new Address('replyto-2@example.com'))
->returnPath(new Address('bounces@example.com'));
$message = $transport->send($mail);

View File

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