Enable PHP mail() on your account
PHP mail() is disabled by default because its messages rarely get delivered. How to enable it if you must, and why SMTP is the better answer.
PHP's mail() function is disabled on WebGee accounts by default. This explains
why, and how to enable it if you genuinely need to.
Mail sent through mail() has a very low chance of reaching an inbox. Enabling
it is strongly discouraged — in nearly every case the right fix is SMTP, which
takes about the same amount of work and actually delivers.
Why it is disabled
Two reasons.
Messages sent this way are usually treated as spoofing. mail() relays
through the server hostname, while your application sets a From address on
your own domain. Receiving servers see a mismatch between who the message claims
to be from and where it actually came from, and filter it accordingly.
It is heavily abused. A single compromised script using mail() can send
thousands of messages before anyone notices, which damages the sending
reputation of the IP addresses shared by every customer on that server.
Use SMTP instead
Sending through an authenticated mailbox on your own domain solves the mismatch entirely — the message is signed, passes SPF and DKIM, and arrives.
- WordPress — Send WordPress email over SMTP
- Custom PHP — use PHPMailer or Symfony Mailer with the settings in Email server settings
- Any other application — nearly all have an SMTP option in their settings
If you still need mail()
-
In cPanel, open Select PHP Version.
-
Select Options.
-
Set
sendmail_pathto:/usr/sbin/sendmail -t -i
The change applies immediately.
Check it worked
php -r 'var_dump(mail("you@example.com","test","test body"));'bool(true) means PHP handed the message off — it does not mean it was
delivered. Check whether it actually arrived, including the spam folder.
If it did not arrive, that is the expected outcome described above, not a fault. Switch to SMTP.
Related
Set up an autoresponder
Create an automatic reply in cPanel for holidays or acknowledgements, with the interval and stop-time settings that stop it becoming a nuisance.
Fix "550 This message was classified as SPAM"
Your outgoing message was scored as spam and returned. What raises the score, and the SMTP authentication setting that is usually responsible.