Commit 1885bee
committed
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 #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.
git-svn-id: https://develop.svn.wordpress.org/trunk@61010 602fd350-edb4-49c9-b593-d223f7449a821 parent 4e64b4a commit 1885bee
File tree
2 files changed
+7
-10
lines changed- src/wp-includes
- tests/phpunit/tests/pluggable
2 files changed
+7
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
412 | 412 | | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
| 413 | + | |
417 | 414 | | |
418 | | - | |
| 415 | + | |
419 | 416 | | |
420 | | - | |
421 | | - | |
| 417 | + | |
| 418 | + | |
422 | 419 | | |
423 | 420 | | |
424 | 421 | | |
425 | | - | |
| 422 | + | |
426 | 423 | | |
427 | 424 | | |
428 | 425 | | |
| |||
0 commit comments