8000 drop the Date header using the Postmark API transport · symfony/symfony@8837566 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8837566

Browse files
committed
drop the Date header using the Postmark API transport
1 parent a2a47bc commit 8837566

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkApiTransportTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ public function testCustomHeader()
7171
$this->assertEquals(['Name' => 'foo', 'Value' => 'bar'], $payload['Headers'][0]);
7272
}
7373

74+
public function testBypassHeaders()
75+
{
76+
$email = (new Email())->date(new \DateTimeImmutable());
77+
$envelope = new Envelope(new Address('alice@system.com'), [new Address('bob@system.com')]);
78+
79+
$transport = new PostmarkApiTransport('ACCESS_KEY');
80+
$method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload');
81+
$payload = $method->invoke($transport, $email, $envelope);
82+
83+
$this->assertArrayNotHasKey('Headers', $payload);
84+
}
85+
7486
public function testSend()
7587
{
7688
$client = new MockHttpClient(function (string $method, string $url, array $options): ResponseInterface {

src/Symfony/Component/Mailer/Bridge/Postmark/Transport/PostmarkApiTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function getPayload(Email $email, Envelope $envelope): array
110110
'Attachments' => $this->getAttachments($email),
111111
];
112112

113-
$headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender', 'reply-to'];
113+
$headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender', 'reply-to', 'date'];
114114
foreach ($email->getHeaders()->all() as $name => $header) {
115115
if (\in_array($name, $headersToBypass, true)) {
116116
continue;

0 commit comments

Comments
 (0)
0