WordPress.org

Make WordPress Core

Ticket #25239: 25239.7.diff

File 25239.7.diff, 3.2 KB (added by pessoft, 2 years ago)

Use network_home_url() as a source of From email's domain instead of SERVER_NAME

  • src/wp-includes/ms-functions.php

     
    838838        $activate_url = esc_url($activate_url);
    839839        $admin_email = get_site_option( 'admin_email' );
    840840        if ( $admin_email == '' )
    841                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     841                $admin_email = 'support@' . parse_url( network_home_url(), PHP_URL_HOST );
    842842        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    843843        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    844844
     
    944944        // Send email with activation link.
    945945        $admin_email = get_site_option( 'admin_email' );
    946946        if ( $admin_email == '' )
    947                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     947                $admin_email = 'support@' . parse_url( network_home_url(), PHP_URL_HOST );
    948948        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    949949        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    950950        $message = sprintf(
     
    15631563        $admin_email = get_site_option( 'admin_email' );
    15641564
    15651565        if ( $admin_email == '' )
    1566                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1566                $admin_email = 'support@' . parse_url( network_home_url(), PHP_URL_HOST );
    15671567
    15681568        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    15691569        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     
    16511651        $admin_email = get_site_option( 'admin_email' );
    16521652
    16531653        if ( $admin_email == '' )
    1654                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1654                $admin_email = 'support@' . parse_url( network_home_url(), PHP_URL_HOST );
    16551655
    16561656        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    16571657        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
  • src/wp-includes/pluggable.php

     
    327327
    328328        if ( !isset( $from_email ) ) {
    329329                // Get the site domain and get rid of www.
    330                 $sitename = strtolower( $_SERVER['SERVER_NAME'] );
     330                $sitename = parse_url( network_home_url(), PHP_URL_HOST );
    331331                if ( substr( $sitename, 0, 4 ) == 'www.' ) {
    332332                        $sitename = substr( $sitename, 4 );
    333333                }
     
    15061506                $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
    15071507        }
    15081508
    1509         $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
     1509        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', parse_url( network_home_url(), PHP_URL_HOST ));
    15101510
    15111511        if ( '' == $comment->comment_author ) {
    15121512                $from = "From: \"$blogname\" <$wp_email>";