Merge branch '5.1'

* 5.1:
  Fix constraint
  [Mailer] Support Return-Path in SesApiAsyncAwsTransport
This commit is contained in:
Fabien Potencier 2020-08-23 11:13:44 +02:00
commit e0ed56b5f0
3 changed files with 7 additions and 2 deletions

View File

@ -70,6 +70,7 @@ class SesApiAsyncAwsTransportTest extends TestCase
$this->assertSame('<b>Hello There!</b>', $content['Content']['Simple']['Body']['Html']['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(['replyto-1@example.com', 'replyto-2@example.com'], $content['ReplyToAddresses']);
$this->assertSame('aws-configuration-set-name', $content['ConfigurationSetName']); $this->assertSame('aws-configuration-set-name', $content['ConfigurationSetName']);
$this->assertSame('bounces@example.com', $content['FeedbackForwardingEmailAddress']);
$json = '{"MessageId": "foobar"}'; $json = '{"MessageId": "foobar"}';
@ -86,7 +87,8 @@ class SesApiAsyncAwsTransportTest extends TestCase
->from(new Address('fabpot@symfony.com', 'Fabien')) ->from(new Address('fabpot@symfony.com', 'Fabien'))
->text('Hello There!') ->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')); ->replyTo(new Address('replyto-1@example.com'), new Address('replyto-2@example.com'))
->returnPath(new Address('bounces@example.com'));
$mail->getHeaders()->addTextHeader('X-SES-CONFIGURATION-SET', 'aws-configuration-set-name'); $mail->getHeaders()->addTextHeader('X-SES-CONFIGURATION-SET', 'aws-configuration-set-name');

View File

@ -92,6 +92,9 @@ class SesApiAsyncAwsTransport extends SesHttpAsyncAwsTransport
if ($header = $email->getHeaders()->get('X-SES-CONFIGURATION-SET')) { if ($header = $email->getHeaders()->get('X-SES-CONFIGURATION-SET')) {
$request['ConfigurationSetName'] = $header->getBodyAsString(); $request['ConfigurationSetName'] = $header->getBodyAsString();
} }
if ($email->getReturnPath()) {
$request['FeedbackForwardingEmailAddress'] = $email->getReturnPath()->toString();
}
return new SendEmailRequest($request); return new SendEmailRequest($request);
} }

View File

@ -18,7 +18,7 @@
"require": { "require": {
"php": ">=7.2.5", "php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1", "symfony/deprecation-contracts": "^2.1",
"symfony/mailer": "^4.4|^5.0" "symfony/mailer": "^5.2"
}, },
"require-dev": { "require-dev": {
"async-aws/ses": "^1.0", "async-aws/ses": "^1.0",