WebGee Docsالتوثيق
Email

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.

If you still need mail()

  1. In cPanel, open Select PHP Version.

  2. Select Options.

  3. Set sendmail_path to:

    /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.

On this page