[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
Mon Aug 25 07:54:44 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:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Mail                                 |     Version:  2.1.1
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-unit-tests has-    |     Focuses:
  test-info                                      |
-------------------------------------------------+-------------------------

Comment (by jdeep):

 Replying to [comment:9 SirLouen]:
 > @jdeep
 >
 > After thinking about this problem I don't really see any point on going
 beyond imap support. Its like: you want advanced features? Install `imap`
 extension, don't ask me to upgrade to a fully featured RFC822 parser for
 something that is going to be used by maybe 0.01% of the WP population.

 Yes that works too.

 > Currently `parseAddresses` support full rfc822 address splitting in all
 the variants. In fact I'm proposing to `PHPMailer` to water down the
 non-`imap`-ext version as much as possible. We cannot reinvent the wheel.
 So, since we have access to the latest version of `PHPMailer` which
 happens to be integrated as an External Library, and it has
 `parseAddresses`, lets use it.

 So basically a refactor of existing code to use `parseAddresses`.

 > So lets take one thing at a time. Maybe we can open a second ticket in
 the future to handle the multiple From part. For now lets try to fix the
 first as I commented in the beginning (with the `parseAddresses` support
 in exchange on the weak logic for parsing headers in the current code)
 >
 > We also need unit tests for this.

 Right. Let me add unit tests to my other patches and then I will start
 refactoring with `parseAddresses` here.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62940#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list