• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved PHP emails vanish into the ether

stevland

Basic Pleskian
Since I migrated my hosting accounts from

OS ‪CentOS 6.8 (Final)‬
Plesk version 12.5.30 Update #60

to

OS ‪CentOS Linux 7.3.1611 (Core)‬
Product Plesk Onyx
Version 17.0.17 Update #17

...all of the 'contact'-style forms on the various websites that I host do not work.

All of these forms use PHP and most of them are within WordPress installations.

Additionally, WordPress administrative notifications are not received.

In all cases the contact forms appear to work: upon submission, a "successful" message is displayed.


But no email shows up.

I can find no evidence that an email was ever received or processed within any of the relevant logs that I can think of, including:

/var/log/maillog
/var/log/httpd/error_log
/var/log/httpd/suexec_log
/var/log/nginx/error_log
/var/log/php-fpm/error.log
/usr/local/psa/var/log/maillog

On the other hand, I successfully sent and received a message using PHP Interactive Shell:

# php -a

Interactive shell

php > mail ('[email protected]', "Testing Mail Server", "This is a test email from CentOS web server", null, "-f em[email protected]");

Can anyone help me out with this? Thanks.
 
Hello,

Are you running the same PHP version, extensions as in the 6.8 server? If yes, I would try adding some more debugging to one of the contact form scripts and try to catch some information from mail().
 
Hello,

Are you running the same PHP version, extensions as in the 6.8 server? If yes, I would try adding some more debugging to one of the contact form scripts and try to catch some information from mail().

Thanks for your response.

I have vastly different versions of PHP on the new server. Being able to support newer versions of PHP was one of the incentives for the upgrade.

I also had to muck around with some of the extensions for PHP 7+ due to changes in what is and is not supported.

But this issue seems to be affecting all hosting accounts regardless of what versions of PHP are being used.
 
Additionally, I have configured the following in php.ini...

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.

mail.log = /var/log/php-maillog

I touched the file, but even after submitting a couple of different forms it remains empty.
 
Hello,

Are you running the same PHP version, extensions as in the 6.8 server? If yes, I would try adding some more debugging to one of the contact form scripts and try to catch some information from mail().

You did give me the idea of switching the version of PHP used by one of the hosting accounts with a non-working contact form. I tried several versions and even set

error_reporting: E_ALL
...but emails continue to disappear and I still do find any related into in any of the log files.
 
Have you unchecked "Allow users and scripts to use Sendmail" in Tools & Settings > Mail Settings so that mails cannot be send from subscription accounts?

Might the mail function be a disabled function in the individual PHP settings of the subscription?

Do you have any specific PHP mail settings in the php.ini files of Plesk PHP installations such as /opt/plesk/php/5.6/etc/php.ini ?
 
POST /contact/?v=1487986015 HTTP/1.0
Have you unchecked "Allow users and scripts to use Sendmail" in Tools & Settings > Mail Settings so that mails cannot be send from subscription accounts?

Might the mail function be a disabled function in the individual PHP settings of the subscription?

Do you have any specific PHP mail settings in the php.ini files of Plesk PHP installations such as /opt/plesk/php/5.6/etc/php.ini ?

Thank you so much for your response.

Actually I have limitations on outgoing email messages switched off entirely as a part of my attempts to resolve this.

I do not believe that the PHP mail function is switched off for any of the accounts, but it certainly is not in the ones I am currently looking at.

I have looked at all of the settings in /opt/plesk/php/x.x/etc/php.ini and I cannot see anything regarding mail that has been added or modified, no.
---

Having said all of this, and while this continues to be a mystery, I have discovered that upgrading WordPress to the latest version (and in some cases replacing the contact form plugin being used with the excellent "Contact Form 7" plugin) seems to resolve this problem. At least this has been the solution for 4 or 5 accounts.

As much as I don't feel like upgrading a couple dozen of my client's WordPress installations and mucking about creating new forms for them, at least I am getting somewhere. I feel like I almost spent as much time trying to properly identify and fix this issue as it will now take me to update everyone.

The one thing I haven't yet done is tested this in non-WordPress websites which use, for example, Drupal or one-off PHP scripts.

I after I know more I will report back in case anyone else runs into this.
 
Actually I have limitations on outgoing email messages switched off entirely as a part of my attempts to resolve this.
That's not the same thing. Outgoing mail control can be set to "unlimited", yet subscriptions might not be authorized to use sendmail.

The one thing I haven't yet done is tested this in non-WordPress websites which use, for example, Drupal or one-off PHP scripts.
Thought you did. That's definitely a thing you'll need to look into. It will greatly help to identify the root cause.
 
P.S. I later realized that this issue was caused by SELinux on my CentOS 7 / Plesk Onyx 17.5.3 server.

I fixed it with the following:

# setsebool -P httpd_can_sendmail=1

# ausearch -c 'sendmail' --raw | audit2allow -M my-sendmail

# semodule -i my-sendmail.pp
 
Back
Top