[wp-trac] [WordPress Trac] #64368: `Could not instantiate mail function` errors sending mail in 6.9

WordPress Trac noreply at wordpress.org
Wed Jan 14 12:10:48 UTC 2026


#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:  has-patch close  |     Focuses:
-----------------------------+-----------------------

Comment (by siliconforks):

 Replying to [comment:75 jorbin]:
 > @SergeyBiryukov @SirLouen Can either of you share some more information
 about how you tested [61468] to ensure it fixes this issue?

 It's complicated to test this because you have to install Sendmail.  Not
 just any Sendmail clone, but the [https://en.wikipedia.org/wiki/Sendmail
 original Sendmail].

 On a Ubuntu 24.04 machine I was able to install Sendmail with the
 following:

 {{{
 apt install sendmail
 }}}

 I wanted to use `example.test` as my domain name, so I edited `/etc/hosts`
 and added the following lines:

 {{{
 127.0.0.1  example.test
 127.0.0.1  www.example.test
 }}}

 I then edited `/etc/mail/local-host-names` and added the following line:

 {{{
 example.test
 }}}

 Then I restarted sendmail:

 {{{
 systemctl restart sendmail
 }}}

 This was sufficient to get local delivery working.  To test it, I
 installed WordPress 6.9 on this machine, I installed the
 [https://wordpress.org/plugins/health-check/ Health Check plugin], and
 then in the admin section I went to **Tools** → **Site Health** →
 **Tools** → **Mail Check**.  I entered an email address
 `user at example.test` where `user` is a local account on this machine, and
 clicked the **Send test mail** button.  It displayed the following
 message: "We have just sent an e-mail using `wp_mail()` and it seems to
 work. Please check your inbox and spam folder to see if you received it."

 To check mail on this machine I installed Mutt:

 {{{
 apt install mutt
 }}}

 Then I logged in as `user` and ran Mutt:

 {{{
 mutt
 }}}

 As expected, this showed the message with subject "Health Check – Test
 Message..." in the inbox.

 Now, to trigger the error condition, I edited the file
 `/etc/php/8.3/fpm/php.ini` and added this line:

 {{{
 sendmail_path = /usr/sbin/sendmail -t -i -fnoreply at example.test
 }}}

 I restarted PHP:

 {{{
 systemctl restart php8.3-fpm
 }}}

 Then I tried sending mail again using the Health Check plugin.  This time
 I received the dreaded error message "Could not instantiate mail
 function".

 Now I applied the patch in [61468] and tried sending mail again.  This
 time it was able to successfully send mail.

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


More information about the wp-trac mailing list