Skip to content

Postmark API mailer transport should exclude the Date header #60254

@rtek

Description

@rtek

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy