diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 7042f2c2ae..dbd52bdd14 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -159,7 +159,6 @@ function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) { $user = new WP_User($user_id); $email = $user->user_email; $name = $user->user_login; - $message_headers = 'From: "' . $blog_title . '" '; $message = sprintf(__("Your new WordPress blog has been successfully set up at: %1\$s @@ -175,7 +174,7 @@ We hope you enjoy your new blog. Thanks! http://wordpress.org/ "), $blog_url, $name, $password); - @wp_mail($email, __('New WordPress Blog'), $message, $message_headers); + @wp_mail($email, __('New WordPress Blog'), $message); } endif; diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 84511f33a1..fc6fc8ff81 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -328,7 +328,13 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() $from_name = 'WordPress'; } - // If we don't have an email from the input headers + /* If we don't have an email from the input headers default to wordpress@$sitename + * Some hosts will block outgoing mail from this address if it doesn't exist but + * there's no easy alternative. Defaulting to admin_email might appear to be another + * option but some hosts may refuse to relay mail from an unknown domain. See + * http://trac.wordpress.org/ticket/5007. + */ + if ( !isset( $from_email ) ) { // Get the site domain and get rid of www. $sitename = strtolower( $_SERVER['SERVER_NAME'] ); @@ -339,7 +345,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() $from_email = 'wordpress@' . $sitename; } - // Set the from name and email + // Plugin authors can override the potentially troublesome default $phpmailer->From = apply_filters( 'wp_mail_from', $from_email ); $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );