[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 Aug 21 12:36:11 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:  Awaiting
                                                 |  Review
Component:  Mail                                 |     Version:  2.1.1
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-unit-tests has-    |     Focuses:
  test-info                                      |
-------------------------------------------------+-------------------------

Comment (by jdeep):

 > >  I feel this is much suited to be implemented properly
 >
 > I don't understand this: Why do you think [https://github.com/WordPress
 /wordpress-develop/blob/d71f29ff0899c6eb29bc037a7c521a966405cb35/src/wp-
 includes/PHPMailer/PHPMailer.php#L1257 its not implemented propertly
 here]?

 As @bhujagendra pointed out, the main issue is in
 [https://github.com/WordPress/wordpress-
 develop/blob/d71f29ff0899c6eb29bc037a7c521a966405cb35/src/wp-
 includes/PHPMailer/PHPMailer.php#L1259 this line] which naively splits the
 string on commas
 which breaks valid address strings like:

 `To: test <test at example.com>, "Joe, Doe" <joe.doe at example.com>`.

 The comma inside the quotation should not be broken to form two separate
 addresses.

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


More information about the wp-trac mailing list