[wp-trac] [WordPress Trac] #49687: wp_mail() - Why is no envelope sender defined?
WordPress Trac
noreply at wordpress.org
Sat Aug 9 10:20:58 UTC 2025
#49687: wp_mail() - Why is no envelope sender defined?
-------------------------------------+------------------------------
Reporter: vbbp | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: 5.4
Severity: major | Resolution:
Keywords: has-test-info has-patch | Focuses:
-------------------------------------+------------------------------
Changes (by SirLouen):
* keywords: needs-testing => has-test-info has-patch
Comment:
Replying to [comment:23 siliconforks]:
> One possible pitfall here is that it appears it is a common
(mis)configuration to have `sendmail_path` in `php.ini` configured with an
`-f` option. If you do that, and then you specify a sender with PHPMailer
(or if you just call PHP's `mail()` function directly while specifying an
`-f` option), you end up providing the `-f` option to `sendmail` twice,
which apparently causes `sendmail` to fail completely.
Nowadays this is impossible because it will manually add to the `-f`
whatever data is in `sendmail_from` and overwrite any other alternative
(like the `From:` coming from the `setFrom` method `auto` param). So the
`sendmail_from` always takes precedence.
> This is mentioned in the PHPMailer wiki (see the part which mentions
`More than one "from" person`):
>
> https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#could-not-
instantiate-mail-function
>
> See also the original bug report:
>
> https://github.com/PHPMailer/PHPMailer/issues/1634
Yes, that could be the issue that was causing trouble back in the day.
This was reported though in 2019, and the issue poped into Trac in 2016.
But this was sorted in 2021 and there are no references to any issues
(later was refined)
https://github.com/PHPMailer/PHPMailer/commit/f9f5b8d21ed2b79fe2e660f2c0ae9c676e30210c
The main problem with an MTA like qmail (and postfix) is the support of
the QMQP federated system which ultimately can provoke that the sending
envelope/return-path (if not specified) ends being one of the servers of
the federation from where the email was sent from (plus the local part,
which generally, by default if unset in qmail is anonymous). In
[https://core.trac.wordpress.org/ticket/49687?replyto=23#comment:18 the
example brought] by @knutsp we can clearly see this problem which is
extremely difficult to reproduce locally because building a federation is
not simple.
On the other side, the problem referenced in [38286] was already sorted
and so far I've been unable to reproduce it under multiple circumstances.
At this point after all the testing (I may add some future proofs but I
think that there is enough info already), and given that the previous
patch was provided with minimal testing feedback it must be reverted and
ideally before 6.9 (because in the remote unlikely case there is a
regression) it will be the shortest span between 6.9 and 6.9.1 to gather
more information and find a better fix than just this weird obfuscation.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49687#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list