Mail: Avoid setting duplicate `MIME-Version` and `X-Mailer` headers in `wp_mail()`, they are added automatically by PHPMailer.
Props lbenicio, junktrunk, danieltj, studyboi, bennemann. Fixes #43542. Built from https://develop.svn.wordpress.org/trunk@46115 git-svn-id: http://core.svn.wordpress.org/trunk@45927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
232d97425c
commit
18bf922527
|
@ -450,11 +450,14 @@ if ( ! function_exists( 'wp_mail' ) ) :
|
||||||
*/
|
*/
|
||||||
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
|
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
|
||||||
|
|
||||||
// Set custom headers
|
// Set custom headers.
|
||||||
if ( ! empty( $headers ) ) {
|
if ( ! empty( $headers ) ) {
|
||||||
foreach ( (array) $headers as $name => $content ) {
|
foreach ( (array) $headers as $name => $content ) {
|
||||||
|
// Only add custom headers not added automatically by PHPMailer.
|
||||||
|
if ( ! in_array( $name, array( 'MIME-Version', 'X-Mailer') ) ) {
|
||||||
$phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
|
$phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) {
|
if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) {
|
||||||
$phpmailer->addCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
|
$phpmailer->addCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-46114';
|
$wp_version = '5.3-alpha-46115';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue