diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 0c61a6f7e1..ca85a85e4e 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -174,6 +174,7 @@ if ( ! function_exists( 'wp_mail' ) ) : * @since 5.5.0 is_email() is used for email validation, * instead of PHPMailer's default validator. * @since 6.9.0 Added $embeds parameter. + * @since 6.9.0 Improved Content-Type header handling for multipart messages. * * @global PHPMailer\PHPMailer\PHPMailer $phpmailer * @@ -351,6 +352,9 @@ if ( ! function_exists( 'wp_mail' ) ) : } elseif ( false !== stripos( $charset_content, 'boundary=' ) ) { $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset_content ) ); $charset = ''; + if ( preg_match( '~^multipart/(\S+)~', $content_type, $matches ) ) { + $content_type = 'multipart/' . strtolower( $matches[1] ) . '; boundary="' . $boundary . '"'; + } } // Avoid setting an empty $content_type. @@ -547,10 +551,6 @@ if ( ! function_exists( 'wp_mail' ) ) : } } } - - if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) { - $phpmailer->addCustomHeader( sprintf( 'Content-Type: %s; boundary="%s"', $content_type, $boundary ) ); - } } if ( ! empty( $attachments ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8c36d21d70..7bfd8a2350 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-beta4-61200'; +$wp_version = '6.9-beta4-61201'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.