Ticket #18923: 18923.diff

File 18923.diff, 1.2 KB (added by solarissmoke, 19 months ago)
  • wp-mail.php

     
    105105 
    106106                        // Set the author using the email address (From or Reply-To, the last used) 
    107107                        // otherwise use the site admin 
    108                         if ( preg_match('/(From|Reply-To): /', $line) )  { 
     108                        if ( ! $author_found && preg_match('/^\s*(From|Reply-To): /', $line) )  { 
    109109                                if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) ) 
    110110                                        $author = $matches[0]; 
    111111                                else 
    112                                         $author = trim($line); 
    113                                 $author = sanitize_email($author); 
    114                                 if ( is_email($author) ) { 
    115                                         echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>'; 
    116                                         $userdata = get_user_by('email', $author); 
    117                                         if ( empty($userdata) ) { 
    118                                                 $author_found = false; 
    119                                         } else { 
     112                                        $author = trim( $line ); 
     113                                $author = sanitize_email( $author ); 
     114                                if ( is_email( $author ) ) { 
     115                                        echo '<p>' . sprintf( __( 'Author is %s' ), $author ) . '</p>'; 
     116                                        $userdata = get_user_by( 'email', $author ); 
     117                                        if ( ! empty( $userdata ) ) { 
    120118                                                $post_author = $userdata->ID; 
    121119                                                $author_found = true; 
    122120                                        } 
    123                                 } else { 
    124                                         $author_found = false; 
    125121                                } 
    126122                        } 
    127123