Make WordPress Core

Changeset 18717


Ignore:
Timestamp:
09/19/2011 02:30:50 PM (15 years ago)
Author:
westi
Message:

Improve the parsing of email addresses in wp_mail to re-support RFC2822 nameless "<address@…>" style. Fixes #18463 props kitchin and SergeyBiryukov.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r18639 r18717  
    339339                        // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
    340340                        $recipient_name = '';
    341                         if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) {
     341                        if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
    342342                                if ( count( $matches ) == 3 ) {
    343343                                        $recipient_name = $matches[1];
     
    345345                                }
    346346                        }
    347                         $phpmailer->AddAddress( trim( $recipient ), $recipient_name);
     347                        $phpmailer->AddAddress( $recipient, $recipient_name);
    348348                } catch ( phpmailerException $e ) {
    349349                        continue;
     
    361361                                // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
    362362                                $recipient_name = '';
    363                                 if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) {
     363                                if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
    364364                                        if ( count( $matches ) == 3 ) {
    365365                                                $recipient_name = $matches[1];
     
    367367                                        }
    368368                                }
    369                                 $phpmailer->AddCc( trim($recipient), $recipient_name );
     369                                $phpmailer->AddCc( $recipient, $recipient_name );
    370370                        } catch ( phpmailerException $e ) {
    371371                                continue;
     
    379379                                // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
    380380                                $recipient_name = '';
    381                                 if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) {
     381                                if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
    382382                                        if ( count( $matches ) == 3 ) {
    383383                                                $recipient_name = $matches[1];
     
    385385                                        }
    386386                                }
    387                                 $phpmailer->AddBcc( trim($recipient), $recipient_name );
     387                                $phpmailer->AddBcc( $recipient, $recipient_name );
    388388                        } catch ( phpmailerException $e ) {
    389389                                continue;
Note: See TracChangeset for help on using the changeset viewer.