[wp-trac] [WordPress Trac] #53048: PHPMailer uses hardcoded default sender mail address, preventing mail to be sent

WordPress Trac noreply at wordpress.org
Fri Apr 16 13:51:44 UTC 2021


#53048: PHPMailer uses hardcoded default sender mail address, preventing mail to be
sent
--------------------------------+-----------------------------
 Reporter:  vinc17              |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  External Libraries  |    Version:  5.6.2
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 The retrieve_password() function of wp-login.php fails with the error
 message "The email could not be sent. Your site may not be correctly
 configured to send emails." when sending the mail because the default
 sender used by wp_mail() is blocked as non-existing (well, I assume that
 this is the cause, because I am not the admin of the local mail server).
 According to the wp_mail() code:
 {{{
                 /*
                  * If we don't have an email from the input headers,
 default to wordpress@$sitename
                  * Some hosts will block outgoing mail from this address
 if it doesn't exist,
                  * but there's no easy alternative. Defaulting to
 admin_email might appear to be
                  * another option, but some hosts may refuse to relay mail
 from an unknown domain.
                  * See https://core.trac.wordpress.org/ticket/5007.
                  */
                 if ( ! isset( $from_email ) ) {
                         // Get the site domain and get rid of www.
                         $sitename = wp_parse_url( network_home_url(),
 PHP_URL_HOST );
                         if ( 'www.' === substr( $sitename, 0, 4 ) ) {
                                 $sitename = substr( $sitename, 4 );
                         }

                         $from_email = 'wordpress@' . $sitename;
                 }
 }}}
 so that the local part of the sender is hardcoded to "wordpress". Even
 though a wordpress e-mail address could be created at my site, sharing the
 same sender address among all the WordPress instances at the site may be a
 bad idea. So this should be configurable.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53048>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list