[wp-trac] [WordPress Trac] #37736: Emails fail on certain server setups

WordPress Trac noreply at wordpress.org
Mon Nov 21 22:32:25 UTC 2016


#37736: Emails fail on certain server setups
-------------------------------------------------+-------------------------
 Reporter:  Clorith                              |       Owner:
     Type:  defect (bug)                         |  boonebgorges
 Priority:  high                                 |      Status:  closed
Component:  Mail                                 |   Milestone:  4.6.1
 Severity:  normal                               |     Version:  4.6
 Keywords:  has-patch needs-testing has-unit-    |  Resolution:  fixed
  tests commit                                   |     Focuses:
-------------------------------------------------+-------------------------

Comment (by travisnorthcutt):

 I haven't been able to fully track this down yet, but FYI I'm seeing
 problems that look like they may be related to this, when creating new
 sites on a multisite install, running 4.6.1.

 I get:


 {{{
 Fatal error: Uncaught phpmailerException: Invalid address: wordpress@
 }}}

 Which appears to come from the following code around line 324 of `/wp-
 includes/pluggable.php:`

 {{{#!php
 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;
         }
 }}}

 So it would seem that in this case `$_SERVER['SERVER_NAME']` isn't set,
 and `PHPMailer->setFrom()` doesn't care for `wordpress@` as a from address
 (as it shouldn't).

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


More information about the wp-trac mailing list