bug #37913 [Mailer] Support Return-Path in SesApiAsyncAwsTransport (cvmiert)

This PR was merged into the 5.1 branch.

Discussion
----------

[Mailer] Support Return-Path in SesApiAsyncAwsTransport

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Enable sending `SendEmailRequest`s with a `Return-Path` configured in
`SesApiAsyncAwsTransport`.

Commits
-------

61754cb891 [Mailer] Support Return-Path in SesApiAsyncAwsTransport
This commit is contained in:
Fabien Potencier 2020-08-23 11:01:08 +02:00
commit 6adb66789e
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);
}