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 Transport doesn't escape commas in name of Address #39416

Copy link
Copy link
Closed
@scvandenbraak

Description

@scvandenbraak
Issue body actions

This is my first bug report / contribution to Symfony (or any other open source project), so I hope I did it correctly. Otherwise, just let me know.

Symfony version(s) affected: 4.4 - 5.2

Description
The Postmark API expects multiple addresses to be split by a comma. When the name of an Address contains a comma, this comma is not escaped. So the Postmark API thinks it's getting multiple addresses, while it's actually one address with a comma in the name.

How to reproduce
See https://github.com/scvandenbraak/symfony-postmark-mailer-comma-bug for example code and README.

When you run the simple example without a Postmark Server token, you'll see the output below, showing the comma has not been escaped.

string(24) "My, Name <me@domain.tld>"

You will get the error if you run a real example with Postmark:

In PostmarkApiTransport.php line 59:
Unable to send an email: Error parsing 'To': Illegal email address 'My'. It must contain the '@' symbol. (code 300).

Possible Solution
Use quotes around the name. This can be fixed in several places:

  1. Method getPayload in Transport/PostmarkApiTransport.php of symfony/postmark-mailer.
  2. Method stringifyAddresses in Transport/AbstractTransport.php of symfony/mailer.
  3. Method toString in Address.php of symfony/mime.

I would guess option 3 is the best, but that depends on which other components rely on this method and it the extra quotes could brake anything. I can also make a PR when I know where it should be fixed.

Additional context
See API description "Multiple addresses are comma separated." at "To" on https://postmarkapp.com/developer/api/email-api#send-a-single-email.

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.