8000 bug #41380 Make Mailgun Header compatible with other Bridges (jderusse) · symfony/symfony@019b2c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 019b2c6

Browse files
bug #41380 Make Mailgun Header compatible with other Bridges (jderusse)
This PR was merged into the 5.2 branch. Discussion ---------- Make Mailgun Header compatible with other Bridges | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This revert deprecating passing a header without the required Mailgun `h:` prefix. And makes the bridge compatible with other bridges. See: - #36148 (comment) - #41308 (comment) Commits ------- 82f1f9c Make Mailgun Header compatible with other Bridges
2 parents 174efe8 + 82f1f9c commit 019b2c6

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

UPGRADE-5.1.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ Inflector
8080
Mailer
8181
------
8282

83-
* Deprecated passing Mailgun headers without their "h:" prefix.
8483
* Deprecated the `SesApiTransport` class. It has been replaced by SesApiAsyncAwsTransport Run `composer require async-aws/ses` to use the new classes.
8584
* Deprecated the `SesHttpTransport` class. It has been replaced by SesHttpAsyncAwsTransport Run `composer require async-aws/ses` to use the new classes.
8685

src/Symfony/Component/Mailer/Bridge/Mailgun/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
CHANGELOG
22
=========
33

4+
5.2
5+
---
6+
7+
* Not prefixing headers with "h:" is no more deprecated
8+
49
5.1.0
10+
-----
511

612
* Not prefixing headers with "h:" is deprecated.
713

src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Transport/MailgunApiTransportTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ public function testTagAndMetadataHeaders()
214214
$json = json_encode(['foo' => 'bar']);
215215
$email = new Email();
216216
$email->getHeaders()->addTextHeader('h:X-Mailgun-Variables', $json);
217+
$email->getHeaders()->addTextHeader('Custom-Header', 'value');
217218
$email->getHeaders()->add(new TagHeader('password-reset'));
218219
$email->getHeaders()->add(new MetadataHeader('Color', 'blue'));
219220
$email->getHeaders()->add(new MetadataHeader('Client-ID', '12345'));
@@ -223,9 +224,10 @@ public function testTagAndMetadataHeaders()
223224
$method = new \ReflectionMethod(MailgunApiTransport::class, 'getPayload');
224225
$method->setAccessible(true);
225226
$payload = $method->invoke($transport, $email, $envelope);
226-
227227
$this->assertArrayHasKey('h:x-mailgun-variables', $payload);
228228
$this->assertEquals($json, $payload['h:x-mailgun-variables']);
229+
$this->assertArrayHasKey('h:custom-header', $payload);
230+
$this->assertEquals('value', $payload['h:custom-header']);
229231
$this->assertArrayHasKey('o:tag', $payload);
230232
$this->assertSame('password-reset', $payload['o:tag']);
231233
$this->assertArrayHasKey('v:Color', $payload);

src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ private function getPayload(Email $email, Envelope $envelope): array
135135
if (\in_array($prefix, ['h:', 't:', 'o:', 'v:']) || \in_array($name, ['recipient-variables', 'template', 'amp-html'])) {
136136
$headerName = $name;
137137
} else {
138-
// fallback to prefix with "h:" to not break BC
139138
$headerName = 'h:'.$name;
140-
@trigger_error(sprintf('Not prefixing the Mailgun header name with "h:" is deprecated since Symfony 5.1. Use header name "%s" instead.', $headerName), \E_USER_DEPRECATED);
141139
}
142140

143141
$payload[$headerName] = $header->getBodyAsString();

0 commit comments

Comments
 (0)
0