[wp-trac] [WordPress Trac] #64368: `Could not instantiate mail function` errors sending mail in 6.9
WordPress Trac
noreply at wordpress.org
Sat Dec 6 21:16:57 UTC 2025
#64368: `Could not instantiate mail function` errors sending mail in 6.9
--------------------------+-----------------------
Reporter: desrosj | Owner: SirLouen
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 6.9.1
Component: Mail | Version: 6.9
Severity: normal | Resolution:
Keywords: close | Focuses:
--------------------------+-----------------------
Comment (by SirLouen):
Replying to [comment:9 siliconforks]:
> Replying to [comment:8 SirLouen]:
> > I've found the solution to this problem.
>
> I don't think it's certain that the double `-f` problem is the only
issue here. [https://core.trac.wordpress.org/ticket/64368#comment:7 This
report] sounds like it is the double `-f` problem, but
[https://core.trac.wordpress.org/ticket/64368#comment:5 this report]
sounds like it's a deliverability problem instead.
[https://core.trac.wordpress.org/ticket/64367 This report] might be either
one - it's hard to tell.
`Sender` affects to SMTP setups as it chooses the `Sender` address instead
of From, if you are not u sing the hook. And for regular mail
installations this is what it takes for the `Sender` related topics.
The first and the last are solved with this (the last is not 100% clear,
but seems to be in line).
There is only one scenario I don't understand.
@studiomondiale told me that when he run `$phpmailer-isSendMail()` he got
this error:
```
Could not execute: /usr/sbin/sendmail -finfo at domain.name -t -i
```
But it works for him having this `sendmail_path`
```
sendmail_path = /usr/sbin/sendmail -finfo at domain.name -t -i
```
My only theory is that his web host have the `popen` restricted because,
regardless of the `Sender` change, if using `$phpmailer->isSendmail`
should have worked as if it will technically execute the same (and is one
of the recommended actions in PHPMailer).
So here are all the 3 possible scenarios.
1. With SMTP the problem is not using the hook
2. With regular mail (mailSend) the problem will be fixed soon
3. With mailSendmail there should not be any problems, in fact probably
any user would have already set the `$phpmailer-Sender` if he was willing
to use this method so this change should have not affected.
So with this in mind, the second one from @digitalblanket is because, if
the `Sender` is set up, then it will set the `From` to the `Sender` if
they are setting the `$phpmailer->From` instead of using the
`wp_mail_from` hook, that will eventually set the `From` and the `Sender`
at the same time with the same value. In his case, the patch coming to
6.9.1 will not solve anything.
Setting directly the `$phpmailer->From` or the `$phpmailer->Sender` is not
the greatest practice (existing the hook), so it's a good opportunity to
fix this and start using the `wp_mail_from` hook.
Since we are using PHPMailer as an abstraction layer instead of an adapter
or a facade, for pretty much any change, there always could be leaks like
these all over the place. In fact, the regression in 2017 would have been
even worse, if DMARC were important back in the day. But DMARC/DKIM has
started surging in the past few years so back in the day no one cared
about these changes as deliverability issues were inexistent.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64368#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list