Skip to content

Commit 8704c18

Browse files
committed
bug #36888 [Mailer] Fix mandrill raw http request setting from email/name (JohJohan)
This PR was merged into the 4.4 branch. Discussion ---------- [Mailer] Fix mandrill raw http request setting from email/name | Q | A | ------------- | --- | Branch? | 4.4, 5.0, 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #36879 | License | MIT | Doc PR | None As describe in symfony/symfony#36879 there is a bug in sending raw http request to mandrill it will not set from email/name correct. As you can see i make sure to set `from_email` and `from_name` correct now and changed the unit test to check correct you can see the doc that the format is correct https://mandrillapp.com/api/docs/messages.curl.html#method-send-raw Commits ------- 6128dd0b75 ticket_36879 - Fix mandrill raw http request setting from email/name
2 parents 161f1d5 + e605799 commit 8704c18

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Mailchimp/Tests/Transport/MandrillHttpTransportTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ public function testSend()
5757
$body = json_decode($options['body'], true);
5858
$message = $body['raw_message'];
5959
$this->assertSame('KEY', $body['key']);
60+
$this->assertSame('Fabien', $body['from_name']);
61+
$this->assertSame('[email protected]', $body['from_email']);
6062
$this->assertSame('[email protected]', $body['to'][0]);
61-
$this->assertSame('Fabien <[email protected]>', $body['from_email']);
6263

6364
$this->assertStringContainsString('Subject: Hello!', $message);
6465
$this->assertStringContainsString('To: Saif Eddin <[email protected]>', $message);

Mailchimp/Transport/MandrillHttpTransport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
4949
'to' => array_map(function (Address $recipient): string {
5050
return $recipient->getAddress();
5151
}, $envelope->getRecipients()),
52-
'from_email' => $envelope->getSender()->toString(),
52+
'from_email' => $envelope->getSender()->getAddress(),
53+
'from_name' => $envelope->getSender()->getName(),
5354
'raw_message' => $message->toString(),
5455
],
5556
]);

MandrillHttpTransport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
4949
'to' => array_map(function (Address $recipient): string {
5050
return $recipient->getAddress();
5151
}, $envelope->getRecipients()),
52-
'from_email' => $envelope->getSender()->toString(),
52+
'from_email' => $envelope->getSender()->getAddress(),
53+
'from_name' => $envelope->getSender()->getName(),
5354
'raw_message' => $message->toString(),
5455
],
5556
]);

MandrillHttpTransportTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ public function testSend()
5757
$body = json_decode($options['body'], true);
5858
$message = $body['raw_message'];
5959
$this->assertSame('KEY', $body['key']);
60+
$this->assertSame('Fabien', $body['from_name']);
61+
$this->assertSame('[email protected]', $body['from_email']);
6062
$this->assertSame('[email protected]', $body['to'][0]);
61-
$this->assertSame('Fabien <[email protected]>', $body['from_email']);
6263

6364
$this->assertStringContainsString('Subject: Hello!', $message);
6465
$this->assertStringContainsString('To: Saif Eddin <[email protected]>', $message);

0 commit comments

Comments
 (0)