[wp-trac] [WordPress Trac] #37548: wp_mail can result in improperly formatted domain when using default 'from' address

WordPress Trac noreply at wordpress.org
Tue Aug 2 21:29:53 UTC 2016


#37548: wp_mail can result in improperly formatted domain when using default 'from'
address
--------------------------+------------------------------
 Reporter:  cklosows      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Mail          |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by cklosows):

 In context, this is the section I've modified:

 {{{
         if ( !isset( $from_email ) ) {
                 // Get the site domain and get rid of www.
                 $sitename = strtolower( $_SERVER['SERVER_NAME'] );
                 if ( substr( $sitename, 0, 4 ) == 'www.' ) {
                         $sitename = substr( $sitename, 4 );
                 }

                 if ( ! filter_var( $sitename, FILTER_VALIDATE_URL ) ) {
                         $sitename = preg_replace( '#^http(s)?://#', '',
 get_home_url() );
                 }

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

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


More information about the wp-trac mailing list