Index: wp-mail.php
===================================================================
--- wp-mail.php	(revision 19916)
+++ wp-mail.php	(working copy)
@@ -105,23 +105,19 @@
 
 			// Set the author using the email address (From or Reply-To, the last used)
 			// otherwise use the site admin
-			if ( preg_match('/(From|Reply-To): /', $line) )  {
-				if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) )
+			if ( ! $author_found && preg_match('/^(From|Reply-To): /', $line) )  {
+				if ( preg_match( '|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches ) )
 					$author = $matches[0];
 				else
-					$author = trim($line);
-				$author = sanitize_email($author);
-				if ( is_email($author) ) {
-					echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
-					$userdata = get_user_by('email', $author);
-					if ( empty($userdata) ) {
-						$author_found = false;
-					} else {
+					$author = trim( $line );
+				$author = sanitize_email( $author );
+				if ( is_email( $author ) ) {
+					echo '<p>' . sprintf( __( 'Author is %s' ), $author ) . '</p>';
+					$userdata = get_user_by( 'email', $author );
+					if ( ! empty( $userdata ) ) {
 						$post_author = $userdata->ID;
 						$author_found = true;
 					}
-				} else {
-					$author_found = false;
 				}
 			}
 
