Add documentation to detail reasoning for default from address. See #5007 props pishmishy

git-svn-id: http://svn.automattic.com/wordpress/trunk@10575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2009-02-15 13:31:43 +00:00
parent bc60e85960
commit ea903eba7e
2 changed files with 9 additions and 4 deletions

View File

@ -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 . '" <wordpress@' . $_SERVER['SERVER_NAME'] . '>';
$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;

View File

@ -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 );