[wp-trac] [WordPress Trac] #16805: default 'from' hostname

WordPress Trac wp-trac at lists.automattic.com
Wed Mar 9 15:11:39 UTC 2011

#16805: default 'from' hostname
 Reporter:  lonnylot      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Mail          |    Version:  3.1
 Severity:  normal        |   Keywords:
 The logic used to create the hostname portion of default e-mail address
 when calling wp_mail doesn't make sense.

 Lines 384-392 of wp-includes/pluggable.php read:
         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 );

                 $from_email = 'wordpress@' . $sitename;

 We assume that if www. is in the sitename that it is not part of the
 e-mail address. I reviewed a few RFCs and have not found where 'www.' is
 prohibited from the hostname portion of an e-mail address. I concede that
 john.smith@ www.sitename.com is now common, but it is still a legal name.

 Additionally, if the $_SERVER[ 'SERVER_NAME' ] is a sub-domain such as
 blogs.sitename.com the e-mail is going to send from john.smith@

 For consistency I suggest we either remove all nth level domain names
 above the first or remove none. This way it will be more obvious when
 people need to use the wp_mail_from filter and not just appear to be

Ticket URL: <http://core.trac.wordpress.org/ticket/16805>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list