[wp-trac] [WordPress Trac] #49687: wp_mail() - Why is no envelope sender defined?

WordPress Trac noreply at wordpress.org
Tue Oct 21 08:04:40 UTC 2025


#49687: wp_mail() - Why is no envelope sender defined?
--------------------------------------------+-----------------------
 Reporter:  vbbp                            |       Owner:  SirLouen
     Type:  enhancement                     |      Status:  closed
 Priority:  normal                          |   Milestone:  6.9
Component:  Mail                            |     Version:  5.4
 Severity:  major                           |  Resolution:  fixed
 Keywords:  has-test-info has-patch commit  |     Focuses:
--------------------------------------------+-----------------------
Changes (by dmsnell):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61010" 61010]:
 {{{
 #!CommitTicketReference repository="" revision="61010"
 wp_mail(): Set sender address by default.

 WordPress has been calling `$phpmailer->setFrom()` with a `false` value
 for an attribute telling it to set the sender address for each message.
 This sender address is also known by other names: Envelope-From, MAIL
 FROM, Return-Path, etc... Unfortunately, this configuration can easily
 lead to mail being rejected by numerous mail hosts due to an invalid
 domain being generated by the local mail server/MTA.

 The flag was originally added with the note that its absence “causes
 outgoing email to fail on some server environments.” However, it is likely
 that this led to the opposite effect, as evidenced by numerous reports,
 plugins, and workarounds over the years.

 In this patch the flag is being removed, which has the effect of letting
 `$phpmailer` set the Sender value, which it does by default using the
 domain “where the front end is accessible” and which is is likely correct.

 After this change there is a chance of mail failure for sites with SPF
 configured but which does not allow mail to be sent on behalf of this
 domain and if those sites also do not have a properly configured DKIM and
 DMARC setup. Those sites should review their SPF policies or the
 `wp_mail_from` filter.

 Developed in https://github.com/WordPress/wordpress-develop/pull/9412
 Discussed in https://core.trac.wordpress.org/ticket/49687

 Follow-up to [38286].

 Props cbutlerjr, dmsnell, jamieburchell, knutsp, kub1x, lordandy1984,
 piskvorky, SergeyBiryukov, siliconforks, SirLouen, stankea, vbbp,
 websupporter.

 Fixes #49687.
 }}}

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


More information about the wp-trac mailing list