Skip to content

Commit 96d23bb

Browse files
Merge branch '6.3' into 6.4
* 6.3: Add missing return type [HttpClient] Fix pausing responses before they start when using curl separate child and parent context in NotificationEmail on writes [Mailer] [Mailgun] Fix sender header encoding do not overwrite the cache key when it is false [Mailer] Throw TransportException when unable to read from socket [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts [HttpClient] Fix error chunk creation in passthru Adjusting and removing the 'review' attribute from the pt_br translation XML. [Serializer] Take unnamed variadic parameters into account when denormalizing Fix context data and display extra data
2 parents a8bce02 + fd185cd commit 96d23bb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Tests/Transport/MailgunApiTransportTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,17 @@ public function testTagAndMetadataHeaders()
268268
$this->assertArrayHasKey('v:Client-ID', $payload);
269269
$this->assertSame('12345', $payload['v:Client-ID']);
270270
}
271+
272+
public function testEnvelopeSenderHeaderIsCorrectlyEncoded()
273+
{
274+
$email = new Email();
275+
$envelope = new Envelope(new Address('[email protected]', 'Žluťoučký Kůň'), [new Address('[email protected]')]);
276+
277+
$transport = new MailgunApiTransport('ACCESS_KEY', 'DOMAIN');
278+
$method = new \ReflectionMethod(MailgunApiTransport::class, 'getPayload');
279+
$payload = $method->invoke($transport, $email, $envelope);
280+
281+
$this->assertArrayHasKey('h:Sender', $payload);
282+
$this->assertSame('=?utf-8?Q?=C5=BDlu=C5=A5ou=C4=8Dk=C3=BD_K=C5=AF=C5=88?= <[email protected]>', $payload['h:Sender']);
283+
}
271284
}

Transport/MailgunApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
8787
private function getPayload(Email $email, Envelope $envelope): array
8888
{
8989
$headers = $email->getHeaders();
90-
$headers->addHeader('h:Sender', $envelope->getSender()->toString());
90+
$headers->addMailboxHeader('h:Sender', $envelope->getSender());
9191
$html = $email->getHtmlBody();
9292
if (null !== $html && \is_resource($html)) {
9393
if (stream_get_meta_data($html)['seekable'] ?? false) {

0 commit comments

Comments
 (0)