[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 23:30:22 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):

 Oops i was using github notation and the code looked terribly. I have
 fixed it.

 Replying to [comment:11 siliconforks]:
 > It looks like he is setting $phpmailer->Sendmail to a complete command
 line, with options?

 No, I asked him to set the `$phpmailer->isSendmail()` method (not
 `$phpmailer->Sendmail`), just to check if his sendmail binary was working.
 But then I forgot that the `popen` PHP function could be restricted in his
 web host, so basically it was a useless test and I asked him to revert.

 Theoretically, with `isSendmail`, none of these issues should have
 occurred (this is why it was recommended in the PHPMailer guidelines). But
 it has been a good opportunity to review that old ticket in PHPMailer you
 mentioned back in the day, that was mostly lost in oblivion without a real
 solution.

 About the PHP-src ticket you opened, I also think that the `sendmail_path`
 example is misleading. The problem is that they clearly chose a weak name
 for the variable `sendmail_path`, so I believe they wanted to showcase
 that they were referring to `sendmail_cmd` instead, and they placed a full
 typical command to explain that you actually have to set in a full
 command, not only a path.

 > Yes, in his case I think that it may require manual intervention by him
 to fix the problem.

 Setting the `$From` is a terrible idea. It's a public property for BC
 strictly, but the right way is to use `SetFrom`, which happens to be what
 the hook does. It's even better to set the `From` in the headers and pass
 the headers to `wp_mail`. From all the options, setting `$From` is the
 worst among all options. So basically, for me, that is more suitable for a
 support forum issue.

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


More information about the wp-trac mailing list