[wp-trac] [WordPress Trac] #51206: wp_mail() not setting Sender address on PhpMailer->setFrom()

WordPress Trac noreply at wordpress.org
Tue Sep 1 13:56:04 UTC 2020

#51206: wp_mail() not setting Sender address on PhpMailer->setFrom()
 Reporter:  lordandy1984  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Mail          |    Version:  5.5
 Severity:  normal        |   Keywords:
  Focuses:                |
 The function wp_mail() is using PhpMailers setFrom method to configure the
 from address.

 But it is setting the last parameter ($auto) to false, meaning the real
 envelope address it not being set.
 Depending on the server configuration of the PHP mail() and sendmail
 installation, this might lead to the script using some weird default
 user/domain configuration.

 Is there a reason not to leave the third parameter to the default value?
 It would then really use the sender address the user enters (e.g. in a
 GravityForm notification), and not something the server/hosting has
 configured or misconfigured?

 **wp_mail() setting the from address:**
 $phpmailer->setFrom( $from_email, $from_name, false );

 **PhpMailer setFrom method:**
 //@param bool $auto Whether to also set the Sender address, defaults to
 setFrom($address, $name = '', $auto = true)

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

More information about the wp-trac mailing list