[wp-trac] [WordPress Trac] #30128: Allow to use associative arrays beside indexed arrays in wp_mail $headers

WordPress Trac noreply at wordpress.org
Wed Aug 6 22:14:22 UTC 2025


#30128: Allow to use associative arrays beside indexed arrays in wp_mail $headers
-------------------------------------------------+-------------------------
 Reporter:  marsjaninzmarsa                      |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Mail                                 |     Version:  2.3
 Severity:  normal                               |  Resolution:
 Keywords:  changes-requested has-patch has-     |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-codex needs-unit-tests needs-refresh =>
     changes-requested has-patch has-unit-tests


Comment:

 The current patch is not only not applying, but it's completely failing to
 achieve its purpose (parsing the associative array with another array
 within, like the CC example).

 It can actually parse simple associative arrays though. So basically we
 can say it needs a little more work.

 I think that if we are going to enable associative arrays for CC and BCC,
 why not also add this for any other custom header according to the
 standard?

 This was commented on here #56779, so I think we can kill two birds with
 one stone.

 I've been trying to work on this patch, but I've noticed there is another
 function that is on the way (and seriously I don't know what it's doing
 there): `wp_staticize_emoji_for_email`. This is almost a copy-paste of the
 original header manipulation function in `wp_mail`, definitely a WET
 function that we should consider refactoring for the health of a patch for
 this report.

 Finally, I'm attaching some unit tests so anyone that would like to work
 on refining the current patch could have a testing reference.

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


More information about the wp-trac mailing list