Fix missing BCC recipients in SES bridge
This commit is contained in:
parent
92ccb0a9df
commit
1cfc763018
@ -60,6 +60,12 @@ class SesHttpTransportTest extends TestCase
|
|||||||
$this->assertStringContainsString('AWS3-HTTPS AWSAccessKeyId=ACCESS_KEY,Algorithm=HmacSHA256,Signature=', $options['headers'][0] ?? $options['request_headers'][0]);
|
$this->assertStringContainsString('AWS3-HTTPS AWSAccessKeyId=ACCESS_KEY,Algorithm=HmacSHA256,Signature=', $options['headers'][0] ?? $options['request_headers'][0]);
|
||||||
|
|
||||||
parse_str($options['body'], $body);
|
parse_str($options['body'], $body);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('Destinations_member_1', $body);
|
||||||
|
$this->assertSame('saif.gmati@symfony.com', $body['Destinations_member_1']);
|
||||||
|
$this->assertArrayHasKey('Destinations_member_2', $body);
|
||||||
|
$this->assertSame('jeremy@derusse.com', $body['Destinations_member_2']);
|
||||||
|
|
||||||
$content = base64_decode($body['RawMessage_Data']);
|
$content = base64_decode($body['RawMessage_Data']);
|
||||||
|
|
||||||
$this->assertStringContainsString('Hello!', $content);
|
$this->assertStringContainsString('Hello!', $content);
|
||||||
@ -83,6 +89,7 @@ class SesHttpTransportTest extends TestCase
|
|||||||
$mail = new Email();
|
$mail = new Email();
|
||||||
$mail->subject('Hello!')
|
$mail->subject('Hello!')
|
||||||
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
|
->to(new Address('saif.gmati@symfony.com', 'Saif Eddin'))
|
||||||
|
->bcc(new Address('jeremy@derusse.com', 'Jérémy Derussé'))
|
||||||
->from(new Address('fabpot@symfony.com', 'Fabien'))
|
->from(new Address('fabpot@symfony.com', 'Fabien'))
|
||||||
->text('Hello There!');
|
->text('Hello There!');
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class SesHttpTransport extends AbstractHttpTransport
|
|||||||
$date = gmdate('D, d M Y H:i:s e');
|
$date = gmdate('D, d M Y H:i:s e');
|
||||||
$auth = sprintf('AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HmacSHA256,Signature=%s', $this->accessKey, $this->getSignature($date));
|
$auth = sprintf('AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HmacSHA256,Signature=%s', $this->accessKey, $this->getSignature($date));
|
||||||
|
|
||||||
$response = $this->client->request('POST', 'https://'.$this->getEndpoint(), [
|
$request = [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'X-Amzn-Authorization' => $auth,
|
'X-Amzn-Authorization' => $auth,
|
||||||
'Date' => $date,
|
'Date' => $date,
|
||||||
@ -61,7 +61,13 @@ class SesHttpTransport extends AbstractHttpTransport
|
|||||||
'Action' => 'SendRawEmail',
|
'Action' => 'SendRawEmail',
|
||||||
'RawMessage.Data' => base64_encode($message->toString()),
|
'RawMessage.Data' => base64_encode($message->toString()),
|
||||||
],
|
],
|
||||||
]);
|
];
|
||||||
|
$index = 1;
|
||||||
|
foreach ($message->getEnvelope()->getRecipients() as $recipient) {
|
||||||
|
$request['body']['Destinations.member.'.$index++] = $recipient->getAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->client->request('POST', 'https://'.$this->getEndpoint(), $request);
|
||||||
|
|
||||||
$result = new \SimpleXMLElement($response->getContent(false));
|
$result = new \SimpleXMLElement($response->getContent(false));
|
||||||
if (200 !== $response->getStatusCode()) {
|
if (200 !== $response->getStatusCode()) {
|
||||||
|
Reference in New Issue
Block a user