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. git-svn-id: https://develop.svn.wordpress.org/trunk@46115 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4a0f1f2a5a
commit
848a329478
@ -450,10 +450,13 @@ if ( ! function_exists( 'wp_mail' ) ) :
|
||||
*/
|
||||
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
|
||||
|
||||
// Set custom headers
|
||||
// Set custom headers.
|
||||
if ( ! empty( $headers ) ) {
|
||||
foreach ( (array) $headers as $name => $content ) {
|
||||
$phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user