[wp-trac] [WordPress Trac] #63127: wp_mail resets custom headers when headers array is set to empty, causing loss of custom header data (e.g., boundary)

WordPress Trac noreply at wordpress.org
Wed Mar 19 16:35:06 UTC 2025


#63127: wp_mail resets custom headers when headers array is set to empty, causing
loss of custom header data (e.g., boundary)
--------------------------+------------------------------
 Reporter:  regnalf       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Mail          |     Version:  6.7.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by regnalf):

 Yes, i wanted to add a boundary to the header. The only way it will be
 processed is to add it as a third array element.

 {{{#!php
 <?php

 $boundary = uniqid ();
 $headers = array ('From: WordPress System <wordpress at domain.com>',
                 'Content-Type: multipart/related; charset=UTF-8;',
                 'boundary="' . $boundary . '"');
 }}}

 In x-debug I could see that the boundary is recognized. However, it is no
 longer included on the way to the phpmailer. And so it is not included in
 the final email.

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


More information about the wp-trac mailing list