PHP mails not working on Cpanel Server

On a cpanel server, PHP scripts can’t sent email. Incoming and outgoing emails for email users (mailbox) are working properly.

To debug, loggged in to SSH as one of the cpanel user.

su - CPANEL_USER

If SSH access is not enabled, enable SSH in WHM.

Advertisement

Once logged in, verify sendmail works.

[sabtempco@buffalo ~]$ sendmail -f noreply@serverok.in admin@serverok.in
sendmail: Not running with correct effective GID.  Is sendmail binary setgid mailtrap?
sendmail: Not running with correct effective GID.  Is sendmail binary setgid mailtrap?
[sabtempco@buffalo ~]$

I get above error message. This is because permission error with /usr/sbin/sendmail.

To fix, run

chmod +x /usr/sbin/sendmail
chmod g+s /usr/sbin/sendmail
chown root:mailtrap /usr/sbin/sendmail

If you are using CloudLinux CageFS, try disable and see if it works. If it work after you disable CafeFS, run

cagefsctl --force-update
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement