Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2db187a

Browse filesBrowse files
committed
drop the Date header using the Postmark API transport
1 parent c5d39dd commit 2db187a
Copy full SHA for 2db187a

File tree

2 files changed

+13
-1
lines changed
Filter options

2 files changed

+13
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Bridge/Postmark/Tests/Transport/PostmarkApiTransportTest.php
+12Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Bridge/Postmark/Transport/PostmarkApiTransport.php
+1-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.