[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
Wed Sep 3 13:52:40 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 |
-------------------------------------------------+-------------------------
Comment (by SirLouen):
> Yes. This would be a good revamp. The only issue is however, are these
two actions:
@jdeep you can simply keep the `$to` as-is, and then add a `$parsed_to` to
work with.
In fact, I believe that it doesnt matter if you pass an string or an array
to `parseAddresses`
https://github.com/SirLouen/wordpress-
develop/blob/cfcb4e9e168b557ea8867ac2b6729c25906a7f54/src/wp-
includes/pluggable.php#L251-L258
It will return the corresponding "parsed_to" with correct values. So you
can leave this as-is, and simply create a `$parsed_to` that you are going
to pass to the `$address_headers`
Also, don't touch the current unit tests, but add new ones with more
complex email formats and lists. Ask @tusharbharti, because I believe he
was working on something with a lot of emails to test, could be of use.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62940#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list