admin管理员组

文章数量:1122826

My wordpress admin area does not seem to be able to send mails. For an example, I tried to change the admin mail address, but I never received the confirmation mail and had to use the plugin Change Admin Email Setting Without Outbound Email to be able to force the email modification.

However, mail sending works perfectly with :

  • WP Mail SMTP plugin (contact forms configured through it, and test mails)
  • WP Test Email plugin (a plugin dedicated to sending mails in order to test configuration)
  • PHP mail() function
  • Shell mailx command (e.g. echo "Message content" | mailx -s "Message subject" [email protected])

There is no related information in access logs, and no output in error logs.

If it may help, wordpress is installed on a VPS which is also a mail server I manually installed and configured with Postfix & Dovecot. SPF, DKIM, and DMARC are also correctly configured and tested using external services that allow to verify all of those configurations. All tests passed.

When I try to change admin mail, even if wordpress tells me that an email has been sent in order to validate the new email address, my postfix logs remain empty, whereas all of the working tests generate lot of postfix logs.

My wordpress admin area does not seem to be able to send mails. For an example, I tried to change the admin mail address, but I never received the confirmation mail and had to use the plugin Change Admin Email Setting Without Outbound Email to be able to force the email modification.

However, mail sending works perfectly with :

  • WP Mail SMTP plugin (contact forms configured through it, and test mails)
  • WP Test Email plugin (a plugin dedicated to sending mails in order to test configuration)
  • PHP mail() function
  • Shell mailx command (e.g. echo "Message content" | mailx -s "Message subject" [email protected])

There is no related information in access logs, and no output in error logs.

If it may help, wordpress is installed on a VPS which is also a mail server I manually installed and configured with Postfix & Dovecot. SPF, DKIM, and DMARC are also correctly configured and tested using external services that allow to verify all of those configurations. All tests passed.

When I try to change admin mail, even if wordpress tells me that an email has been sent in order to validate the new email address, my postfix logs remain empty, whereas all of the working tests generate lot of postfix logs.

Share Improve this question asked Jul 20, 2024 at 15:37 John KraviczJohn Kravicz 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

I found the issue, had to edit /etc/php/8.3/cli/php.ini file, by adding/editing following lines :

[mail function]
; For Win32 only.
; https://php.net/smtp
#SMTP = localhost
SMTP = mysmtpserver.domain
; https://php.net/smtp-port
smtp_port = 25
username = myusername
password = mypassword
sendmail_from = [email protected]

Then a service nginx restart.

I still don't understand why PHP is able to send mails through mail() function, but Wordpress need the php.ini file to be configured... Anyway, hope this helps !

本文标签: