Symptoms
-
After Plesk update or on a new Plesk installation on CentOS 7 minimal, the PHP mail doesn’t work.
-
Unable to send an email with a PHP application, the following error is shown:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
-
The following error might be shown in the following log files:
-
Apache log file
/var/log/httpd/error.log
:sh: /usr/sbin/sendmail: Permission denied
-
In the PHP-FPM log fileÂ
/var/log/plesk-phpXX-fpm/error.log
:Note: Where XX is the PHP-FPM version selected in the domain.
WARNING: [pool example.com] child 21423 said into stderr: "sh: /usr/sbin/sendmail: Permission denied"
-
-
The symlink
/etc/alternatives/mta
is as follows:# ls -l /etc/alternatives/mta
lrwxrwxrwx. 1 root root 26 Oct 23 23:07 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix
Cause
This is a Plesk bug with the IDÂ #PPP-46267 which is planned to be fixed in future Plesk updates.
Note: Subscribe to the article to get notified once a fix will become available
Resolution
As a workaround:
-
Connect to the server via SSH
- Create two symlinks:
# ln -s /etc/pam.d/smtp.postfix /etc/alternatives/mta-pam
# ln -s /etc/alternatives/mta-pam /etc/pam.d/smtp -
Unlink the file
/etc/alternatives/mta
:# unlink /etc/alternatives/mta
-
Re-create the Symlink pointing to
/usr/lib64/plesk-9.0/postfix-sendmail-wrapper
binary:# ln -s /usr/lib64/plesk-9.0/postfix-sendmail-wrapper /etc/alternatives/mta