Problem/Motivation

MessageBuilder splits To/Cc/Bcc on commas and semicolons with a naive preg_split('/[,;]/', ...). That breaks valid RFC 2822 addresses whose quoted display name contains a comma, for example "John Doe, MPH" <user@example.com>.

This became more visible after Mime Mail started formatting recipient addresses with getDisplayName() (#3388498). Symfony then throws RfcComplianceException (e.g. Email ""John Doe" does not comply with addr-spec of RFC 2822.).

Steps to reproduce

1. Enable amazon_ses as the mail sender (optionally with Mime Mail as formatter, simple_address disabled).
2. Send mail to a user whose display name contains a comma (e.g. John Doe, MPH).
3. Observe RfcComplianceException when building the message.

Proposed resolution

Split mailbox-list headers only on commas/semicolons outside double quotes (same idea as core SymfonyMailer using str_getcsv()), so quoted display names are preserved. Keep support for both , and ; as separators.

Remaining tasks

  • Review / commit patch
  • Add test coverage for quoted display names with commas

User interface changes

None.

API changes

None (internal parsing only). Optional protected helper if extracted.

Data model changes

None.

Issue fork amazon_ses-3612655

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

orakili created an issue. See original summary.

orakili’s picture

Version: 3.0.x-dev » 3.x-dev

orakili’s picture

Status: Active » Needs review