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

Postmark API mailer transport should exclude the Date header #60254

Copy link
Copy link
Closed
@rtek

Description

@rtek
Issue body actions

Symfony version(s) affected

6.4.19

Description

When sending an email using the Postmark API transport, with a Date header set, postmark rejects the message, and the transport throws this exception:

Fatal error: Uncaught Symfony\Component\Mailer\Exception\HttpTransportException: 
Unable to send an email: Header 'Date' not allowed. (code 300). in
/vendor/symfony/postmark-mailer/Transport/PostmarkApiTransport.php:72

How to reproduce

$transport = new \Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkApiTransport('***');
$email = new \Symfony\Component\Mime\Email();

$email->text(date('c'))
    ->to('foo@localhost')
    ->from('bar@localhost')
    ->date(new \DateTimeImmutable());

$transport->send($email);

//PHP Fatal error:  Uncaught Symfony\Component\Mailer\Exception\HttpTransportException: Unable to send an email: Header 'Date' not allowed. (code 300). in vendor/symfon/postmark-
mailer/Transpor/PostmarkApiTransport.php:72

Possible Solution

Fix is to add 'date' to this exclusion list: https://github.com/symfony/postmark-mailer/blob/7.2/Transport/PostmarkApiTransport.php#L113

Workaround is to remove the date header from the email before sending it.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.