Skip to content

refactor: use PHPMailer's parseAddresses#9697

Draft
JDeepD wants to merge 5 commits intoWordPress:trunkfrom
JDeepD:refactor/use-phpmailer-parseaddresses
Draft

refactor: use PHPMailer's parseAddresses#9697
JDeepD wants to merge 5 commits intoWordPress:trunkfrom
JDeepD:refactor/use-phpmailer-parseaddresses

Conversation

@JDeepD
Copy link
Copy Markdown

@JDeepD JDeepD commented Sep 1, 2025

Current implementation uses naive approach of
splitting email address headers at ,. This makes perfectly valid headers like
"Jane, Doe" <jane@example.com> break. But this is a perfectly valid RFC-5322 email address header.

We should use PHPMailer's parseAddresses() function which uses IMAP extension (if available) which addresses this issue instead of the current implementation.

Trac ticket: #62940

TODO:

  • Add Unit Tests with IMAP Extension enabled.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 1, 2025

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@JDeepD JDeepD force-pushed the refactor/use-phpmailer-parseaddresses branch 3 times, most recently from 451d6c4 to 73f43b9 Compare September 10, 2025 11:33
@JDeepD JDeepD force-pushed the refactor/use-phpmailer-parseaddresses branch 3 times, most recently from b891f55 to 8fbc583 Compare September 12, 2025 08:21
Current implementation uses naive approach of splitting email address
headers at ,. This makes perfectly valid headers like
"Jane, Doe" <jane@example.com> break.

We should use PHPMailer's parseAddresses() function which uses IMAP extension
(if available) which addresses this issue instead of the current implementation.

Additionally, add support for encoded addresses in headers with the help of
parseAddresses().

Trac ticket: #62940
@JDeepD JDeepD force-pushed the refactor/use-phpmailer-parseaddresses branch from 8fbc583 to 697bb53 Compare September 16, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant