[wp-trac] [WordPress Trac] #15448: wp_mail() sets Content-Type header twice for multipart emails

WordPress Trac noreply at wordpress.org
Tue Aug 19 10:58:17 UTC 2025


#15448: wp_mail() sets Content-Type header twice for multipart emails
-------------------------------------------------+-------------------------
 Reporter:  rmccue                               |       Owner:  SirLouen
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  high                                 |   Milestone:  6.9
Component:  Mail                                 |     Version:  2.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-test-   |     Focuses:
  info                                           |
-------------------------------------------------+-------------------------
Changes (by abcd95):

 * keywords:  has-patch has-unit-tests has-test-info needs-testing => has-
     patch has-unit-tests has-test-info


Comment:

 == Test Report
 === Description

 This report validates that the indicated patch works as expected.

 Patch tested: https://github.com/WordPress/wordpress-
 develop/pull/9500.patch

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.25
 - Server: nginx/1.29.1
 - Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.25)
 - Browser: Chrome 139.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins: None activated
 - Plugins:
   * Multipart Mixed Test
   * Test Reports 1.2.0
   * WP Mail SMTP 4.5.0

 === Actual Results

 ✅ Emails sent via wp_mail() with multipart content are now parsed
 correctly.
 ✅ Mailpit displays plain text and HTML parts in their respective tabs.
 ✅ Attachments (e.g., dummy.pdf) are properly recognized and accessible.
 ✅ MIME boundaries and headers are no longer visible in the email body.

 === Additional Notes
 Before applying the patch, Mailpit displayed the raw multipart structure
 with MIME headers inline, and attachments were not detected.
 After applying the patch, the behavior aligns with the expected PHPMailer
 handling of multipart messages. Also, no regressions observed in basic
 wp_mail() functionality.

 === Supplemental Artifacts

 ==== Before applying the patch

 [[Image(https://i.ibb.co/Swfk6t7m/Screenshot-2025-08-19-at-16-15-06.png)]]

 ==== After applying the patch

 [[Image(https://i.ibb.co/Fq8mFNTy/Screenshot-2025-08-19-at-16-15-40.png)]]
 [[Image(https://i.ibb.co/SXfjptCR/Screenshot-2025-08-19-at-16-15-58.png)]]

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


More information about the wp-trac mailing list