$phpmailer->CharSet =
apply_filters( 'wp_mail_charset',
$charset );
// Set custom headers.
if ( !
empty( $headers ) ) { foreach ( (array) $headers as $name =>
$content ) { // Only add custom headers not added automatically by PHPMailer.
if ( !
in_array( $name, array
( 'MIME-Version', 'X-Mailer'
), true
) ) { try { $phpmailer->
addCustomHeader( sprintf( '%1$s: %2$s',
$name,
$content ) );
} catch ( PHPMailer\PHPMailer\Exception
$e ) { continue;
} } } if ( false !==
stripos( $content_type, 'multipart'
) && !
empty( $boundary ) ) { $phpmailer->
addCustomHeader( sprintf( 'Content-Type: %s; boundary="%s"',
$content_type,
$boundary ) );
} }