[wp-trac] [WordPress Trac] #25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names

WordPress Trac noreply at wordpress.org
Fri May 5 09:13:10 UTC 2017


#25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names
-------------------------------------------------+-------------------------
 Reporter:  layotte                              |       Owner:
     Type:  defect (bug)                         |  SergeyBiryukov
 Priority:  normal                               |      Status:  reviewing
Component:  Mail                                 |   Milestone:  Future
 Severity:  normal                               |  Release
 Keywords:  has-patch dev-feedback needs-        |     Version:  3.8
  testing                                        |  Resolution:
                                                 |     Focuses:
-------------------------------------------------+-------------------------

Comment (by robert.peake):

 @tsimmons @kitchin Indeed, seems like it might be most backwards-
 compatible with the current solution to just do:

 {{{#!php
 <?php
 ...
 if ( !isset( $from_email ) ) {
     // Get the site domain and get rid of www.
     $sitename = strtolower( parse_url( get_home_url( get_current_blog_id()
 ), PHP_URL_HOST ) );
     if ( substr( $sitename, 0, 4 ) == 'www.' ) {
         $sitename = substr( $sitename, 4 );
     }

     $from_email = 'wordpress@' . $sitename;
 ...
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25239#comment:63>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list