Ticket #5204: email_fix_refreshed.5204.diff
| File email_fix_refreshed.5204.diff, 2.1 KB (added by filosofo, 4 years ago) |
|---|
-
wp-includes/pluggable.php
282 282 if ( !empty( $tempheaders ) ) { 283 283 // Iterate through the raw headers 284 284 foreach ( (array) $tempheaders as $header ) { 285 if ( strpos($header, ':') === false ) 285 if ( strpos($header, ':') === false ) { 286 if ( false !== stripos( $header, 'boundary=' ) ) { 287 $parts = preg_split('/boundary=/i', trim( $header ) ); 288 $boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) ); 289 } 286 290 continue; 291 } 287 292 // Explode them out 288 293 list( $name, $content ) = explode( ':', trim( $header ), 2 ); 289 294 … … 309 314 if ( strpos( $content,';' ) !== false ) { 310 315 list( $type, $charset ) = explode( ';', $content ); 311 316 $content_type = trim( $type ); 312 $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) ); 317 if ( false !== stripos( $charset, 'charset=' ) ) { 318 $charset = trim( str_replace( array( 'charset=', '"' ), '', $charset ) ); 319 } elseif ( false !== stripos( $charset, 'boundary=' ) ) { 320 $boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset ) ); 321 $charset = ''; 322 } 313 323 } else { 314 324 $content_type = trim( $content ); 315 325 } … … 391 401 392 402 $content_type = apply_filters( 'wp_mail_content_type', $content_type ); 393 403 404 $phpmailer->ContentType = $content_type; 405 394 406 // Set whether it's plaintext or not, depending on $content_type 395 407 if ( $content_type == 'text/html' ) { 396 408 $phpmailer->IsHTML( true ); 397 } else {398 $phpmailer->IsHTML( false );399 409 } 400 410 401 411 // If we don't have a charset from the input headers … … 411 421 foreach( (array) $headers as $name => $content ) { 412 422 $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 413 423 } 424 if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) { 425 $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) ); 426 } 414 427 } 415 428 416 429 if ( !empty( $attachments ) ) {
