[wp-trac] [WordPress Trac] #62940: wp_mail(): Address header parsing is not RFC-5322 complient and fails on quoted-string when including a "<", ">" or ", "
WordPress Trac
noreply at wordpress.org
Thu Sep 11 19:15:25 UTC 2025
#62940: wp_mail(): Address header parsing is not RFC-5322 complient and fails on
quoted-string when including a "<", ">" or ","
-------------------------------------------------+-------------------------
Reporter: bhujagendra | Owner: jdeep
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future
| Release
Component: Mail | Version: 2.1.1
Severity: normal | Resolution:
Keywords: needs-unit-tests has-test-info has- | Focuses:
patch changes-requested |
-------------------------------------------------+-------------------------
Comment (by SirLouen):
@jdeep I've been thinking and we have to refactor again the code
We cannot parse addresses on the fly
Because the content-type has to be set **before** we start parsing
If the content type is the last line in the headers, it will be parsed too
late leaving the rest of the headers without a content-type (by default
its almost always going to be `utf-8` but we have to respect the content-
type set in the headers
For this reason, we have to do an address parsing after the headers have
been set in the switch, not during.
Also, the test you sent me look good. They are simply but escalable. I've
been thinking that since you repeat so much the exact same test, maybe we
should do them the other way around (testing for all the types the same,
and adding new addresses, will simply test for all types). Even you can
use the exact same dataProvider for all, including the To (and leave the
From dataprovider independent because we can only test with a single
address). Remember I'm just giving some ideas that come to my mind, if you
have any idea to improve comment it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62940#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list