Skip to content

Commit 988f39b

Browse files
committed
Merge branch '5.1'
* 5.1: Fix constraint [Mailer] Support Return-Path in SesApiAsyncAwsTransport
2 parents ff20910 + ca23506 commit 988f39b

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

Amazon/Tests/Transport/SesApiAsyncAwsTransportTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function testSend()
7070
$this->assertSame('<b>Hello There!</b>', $content['Content']['Simple']['Body']['Html']['Data']);
7171
$this->assertSame(['[email protected]', '[email protected]'], $content['ReplyToAddresses']);
7272
$this->assertSame('aws-configuration-set-name', $content['ConfigurationSetName']);
73+
$this->assertSame('[email protected]', $content['FeedbackForwardingEmailAddress']);
7374

7475
$json = '{"MessageId": "foobar"}';
7576

@@ -86,7 +87,8 @@ public function testSend()
8687
->from(new Address('[email protected]', 'Fabien'))
8788
->text('Hello There!')
8889
->html('<b>Hello There!</b>')
89-
->replyTo(new Address('[email protected]'), new Address('[email protected]'));
90+
->replyTo(new Address('[email protected]'), new Address('[email protected]'))
91+
->returnPath(new Address('[email protected]'));
9092

9193
$mail->getHeaders()->addTextHeader('X-SES-CONFIGURATION-SET', 'aws-configuration-set-name');
9294

Amazon/Transport/SesApiAsyncAwsTransport.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ protected function getRequest(SentMessage $message): SendEmailRequest
9292
if ($header = $email->getHeaders()->get('X-SES-CONFIGURATION-SET')) {
9393
$request['ConfigurationSetName'] = $header->getBodyAsString();
9494
}
95+
if ($email->getReturnPath()) {
96+
$request['FeedbackForwardingEmailAddress'] = $email->getReturnPath()->toString();
97+
}
9598

9699
return new SendEmailRequest($request);
97100
}

Amazon/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=7.2.5",
2020
"symfony/deprecation-contracts": "^2.1",
21-
"symfony/mailer": "^4.4|^5.0"
21+
"symfony/mailer": "^5.2"
2222
},
2323
"require-dev": {
2424
"async-aws/ses": "^1.0",

SesApiAsyncAwsTransport.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ protected function getRequest(SentMessage $message): SendEmailRequest
9292
if ($header = $email->getHeaders()->get('X-SES-CONFIGURATION-SET')) {
9393
$request['ConfigurationSetName'] = $header->getBodyAsString();
9494
}
95+
if ($email->getReturnPath()) {
96+
$request['FeedbackForwardingEmailAddress'] = $email->getReturnPath()->toString();
97+
}
9598

9699
return new SendEmailRequest($request);
97100
}

SesApiAsyncAwsTransportTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function testSend()
7070
$this->assertSame('<b>Hello There!</b>', $content['Content']['Simple']['Body']['Html']['Data']);
7171
$this->assertSame(['[email protected]', '[email protected]'], $content['ReplyToAddresses']);
7272
$this->assertSame('aws-configuration-set-name', $content['ConfigurationSetName']);
73+
$this->assertSame('[email protected]', $content['FeedbackForwardingEmailAddress']);
7374

7475
$json = '{"MessageId": "foobar"}';
7576

@@ -86,7 +87,8 @@ public function testSend()
8687
->from(new Address('[email protected]', 'Fabien'))
8788
->text('Hello There!')
8889
->html('<b>Hello There!</b>')
89-
->replyTo(new Address('[email protected]'), new Address('[email protected]'));
90+
->replyTo(new Address('[email protected]'), new Address('[email protected]'))
91+
->returnPath(new Address('[email protected]'));
9092

9193
$mail->getHeaders()->addTextHeader('X-SES-CONFIGURATION-SET', 'aws-configuration-set-name');
9294

0 commit comments

Comments
 (0)