Make WordPress Core


Ignore:
Timestamp:
07/24/2020 05:38:27 PM (4 years ago)
Author:
whyisjake
Message:

Mail: Ensure that a server hostname can be set by using network_home_url().

Due to the varying server setups, $_SERVER['SERVER_NAME']; can't reliably ensure that there will be a relevant host that could be used as the hostname in an email. Since the network_home_url() is set at this point, and is filterable, this should better enable emails to be sent from the server.

Fixes #25239.
Props layotte, SergeyBiryukov, nacin, sreedoap, szepe.viktor, jesin, kitchin, mensmaximus, mt8.biz, Grzegorz.Janoszka, cbutlerjr, dd32, BjornW, neodjandre, BjornW, Ipstenu, ocean90, danielbachhuber, desmith, joemcgill, jdgrimes, riasat, derekakelly, swissspidy, lilmike, tsimmons, robert.peake, DavidAnderson, cloudstek, pigdog234, BjornW, rawrly, pessoft, RedSand, seayou, dvershinin, bastho, chesio, Starbuck, afragen, ocean90, whyisjake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r48511 r48601  
    953953
    954954    if ( '' === $admin_email ) {
    955         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     955        $admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
    956956    }
    957957
     
    10801080
    10811081    if ( '' === $admin_email ) {
    1082         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1082        $admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
    10831083    }
    10841084
     
    16641664
    16651665    if ( '' === $admin_email ) {
    1666         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1666        $admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
    16671667    }
    16681668
     
    17561756
    17571757    if ( '' === $admin_email ) {
    1758         $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1758        $admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
    17591759    }
    17601760
Note: See TracChangeset for help on using the changeset viewer.