Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2706a97

Browse files
committed
Don't duplicate addresses in Sendgrid Transport
1 parent6d6cea2 commit2706a97

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

‎src/Symfony/Component/Mailer/Bridge/Sendgrid/Http/Api/SendgridTransport.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private function getPayload(Email $email, SmtpEnvelope $envelope): array
6767
}
6868

6969
$personalization = [
70-
'to' =>array_map($addressStringifier,$this->getRecipients($email,$envelope)),
70+
'to' =>array_map($addressStringifier,$email->getTo()),
7171
'subject' =>$email->getSubject(),
7272
];
7373
if ($emails =array_map($addressStringifier,$email->getCc())) {
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Component\Mailer\Bridge\Sendgrid\Tests\Http\Api;
13+
14+
usePHPUnit\Framework\TestCase;
15+
useSymfony\Component\Mailer\Bridge\Sendgrid\Http\Api\SendgridTransport;
16+
useSymfony\Component\Mime\Email;
17+
useSymfony\Contracts\HttpClient\HttpClientInterface;
18+
useSymfony\Contracts\HttpClient\ResponseInterface;
19+
20+
class SendgridTransportTestextends TestCase
21+
{
22+
publicfunctiontestSend()
23+
{
24+
$email =newEmail();
25+
$email->from('foo@example.com')
26+
->to('bar@example.com')
27+
->bcc('baz@example.com');
28+
29+
$response =$this->createMock(ResponseInterface::class);
30+
31+
$response
32+
->expects($this->once())
33+
->method('getStatusCode')
34+
->willReturn(202);
35+
36+
$httpClient =$this->createMock(HttpClientInterface::class);
37+
38+
$httpClient
39+
->expects($this->once())
40+
->method('request')
41+
->with('POST','https://api.sendgrid.com/v3/mail/send', [
42+
'json' => [
43+
'personalizations' => [
44+
[
45+
'to' => [['email' =>'bar@example.com']],
46+
'subject' =>null,
47+
'bcc' => [['email' =>'baz@example.com']],
48+
],
49+
],
50+
'from' => ['email' =>'foo@example.com'],
51+
'content' => [],
52+
],
53+
'auth_bearer' =>'foo',
54+
])
55+
->willReturn($response);
56+
57+
$mailer =newSendgridTransport('foo',$httpClient);
58+
59+
$mailer->send($email);
60+
}
61+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp