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

Skip to content

Commit 2db187a

Browse files
committed
drop the Date header using the Postmark API transport
1 parent c5d39dd commit 2db187a

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
@@ -69,6 +69,18 @@ public function testCustomHeader()
6969
$this->assertEquals(['Name' => 'foo', 'Value' => 'bar'], $payload['Headers'][0]);
7070
}
7171

72+
public function testBypassHeaders()
73+
{
74+
$email = (new Email())->date(new \DateTimeImmutable());
75+
$envelope = new Envelope(new Address('alice@system.com'), [new Address('bob@system.com')]);
76+
77+
$transport = new PostmarkApiTransport('ACCESS_KEY');
78+
$method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload');
79+
$payload = $method->invoke($transport, $email, $envelope);
80+
81+
$this->assertArrayNotHasKey('Headers', $payload);
82+
}
83+
7284
public function testSend()
7385
{
7486
$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
@@ -91,7 +91,7 @@ private function getPayload(Email $email, Envelope $envelope): array
9191
'Attachments' => $this->getAttachments($email),
9292
];
9393

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

0 commit comments

Comments
 (0)
0