compare mail headers case-insensitively and actually use the Content-Type specified. Props Nazgul. see: #4296

git-svn-id: http://svn.automattic.com/wordpress/trunk@5762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-06-26 18:28:56 +00:00
parent 829ace3e68
commit d9d5fde1e7
1 changed files with 3 additions and 3 deletions

View File

@ -193,7 +193,7 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
$content = trim( $content ); $content = trim( $content );
// Mainly for legacy -- process a From: header if it's there // Mainly for legacy -- process a From: header if it's there
if ( $name == 'From' ) { if ( 'from' == strtolower($name) ) {
if ( strpos($content, '<' ) !== false ) { if ( strpos($content, '<' ) !== false ) {
// So... making my life hard again? // So... making my life hard again?
$from_name = substr( $content, 0, strpos( $content, '<' ) - 1 ); $from_name = substr( $content, 0, strpos( $content, '<' ) - 1 );
@ -206,7 +206,7 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
} else { } else {
$from_name = trim( $content ); $from_name = trim( $content );
} }
} elseif ( $name == 'Content-Type' ) { } elseif ( 'content-type' == strtolower($name) ) {
if ( strpos( $content,';' ) !== false ) { if ( strpos( $content,';' ) !== false ) {
list( $type, $charset ) = explode( ';', $content ); list( $type, $charset ) = explode( ';', $content );
$content_type = trim( $content_type ); $content_type = trim( $content_type );
@ -281,7 +281,7 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
} }
// Set the content-type and charset // Set the content-type and charset
$phpmailer->ContentType = apply_filters( 'wp_mail_content_type', 'text/plain' ); $phpmailer->ContentType = apply_filters( 'wp_mail_content_type', $content_type );
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
// Set custom headers // Set custom headers