# Enable PHP mail() on your account
Source: https://docs.webgee.com/en/email/enabling-phpmail-on-your-account



PHP's `mail()` function is disabled on WebGee accounts by default. This explains
why, and how to enable it if you genuinely need to.

<Callout type="warn">
  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.
</Callout>

## Why it is disabled [#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 [#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](/en/hosting/wordpress/how-to-send-emails-in-wordpress-using-the-wp-smtp-mail-plugin)
* **Custom PHP** — use PHPMailer or Symfony Mailer with the settings in
  [Email server settings](/en/email/manual-configuration)
* **Any other application** — nearly all have an SMTP option in their settings

## If you still need mail() [#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 [#check-it-worked]

```bash
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 [#related]

* [Send WordPress email over SMTP](/en/hosting/wordpress/how-to-send-emails-in-wordpress-using-the-wp-smtp-mail-plugin)
* [Why am I not able to send mail via my PHP script?](/en/email/why-am-i-not-able-to-send-mail-via-my-php-script-or-application)
* [SPF records for WebGee hosting](/en/email/what-are-the-correct-spf-records-when-using-webgee-hosting)
