[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
Tue Sep 2 18:59:37 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 jdeep):

 @SirLouen Yeah, I was thinking closures might not be the best option since
 they aren’t commonly used elsewhere in the codebase. At the same time, I
 didn't want to write redundant address-parsing logic in multiple places,
 which is why I considered adding a helper function. But, `pluggable.php`
 doesn’t have helper functions either, so it didn’t feel like the right
 place for it.

 > ideally, I would like in the near future to encapsulate the wp_mail
 function, so a method with private visibility would be ideal for this case

 True. `wp_mail()` has grown quite complex enough (over 400 LOC) and seems
 like a good candidate for a dedicated class. But would be a major
 refactor.

 > For this reason, and for now, we need to versions: One version checking
 for the IMAP extension and markTestSkipped if it doesn't exist. Like this
 > This version can include complex scenarios, like the ones proposed by
 the OP, with commas and square brackets.
 > And the other, running very basic tests with very simple addresses (can
 be multiple addresses, but very simple, like "Name
 <email(at)example.com>", or just the email).

 Okay. Got it. Thanks.

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


More information about the wp-trac mailing list