Skip to content

Navigation Menu

Sign in
Appearance settings

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

[Mailer][Postmark] drop the Date header using the API transport #60256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
drop the Date header using the Postmark API transport
  • Loading branch information
xabbuh committed Apr 29, 2025
commit 2db187aec384f476e8f8d5e55be38c735419e37f
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ public function testCustomHeader()
$this->assertEquals(['Name' => 'foo', 'Value' => 'bar'], $payload['Headers'][0]);
}

public function testBypassHeaders()
{
$email = (new Email())->date(new \DateTimeImmutable());
$envelope = new Envelope(new Address('alice@system.com'), [new Address('bob@system.com')]);

$transport = new PostmarkApiTransport('ACCESS_KEY');
$method = new \ReflectionMethod(PostmarkApiTransport::class, 'getPayload');
$payload = $method->invoke($transport, $email, $envelope);

$this->assertArrayNotHasKey('Headers', $payload);
}

public function testSend()
{
$client = new MockHttpClient(function (string $method, string $url, array $options): ResponseInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private function getPayload(Email $email, Envelope $envelope): array
'Attachments' => $this->getAttachments($email),
];

$headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender', 'reply-to'];
$headersToBypass = ['from', 'to', 'cc', 'bcc', 'subject', 'content-type', 'sender', 'reply-to', 'date'];
foreach ($email->getHeaders()->all() as $name => $header) {
if (\in_array($name, $headersToBypass, true)) {
continue;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.