WebGee DocsDocs
Email
Free migration + 30-day money-backSee how

Why mail from your PHP script or application fails

PHP's mail() function is disabled by default because the mail it sends looks like spoofing. How to send through SMTP instead.

If your contact form, WooCommerce store or web application cannot send email, the cause is almost always PHP's built-in mail() function. Applies to shared, reseller and cPanel hosting.

mail() is disabled by default on WebGee servers.

Why it is disabled

mail() hands a message straight to the server with no authentication. The server has no way to confirm the sender is who the message claims, so it stamps the message with the account's own system address — something like youruser@server.webgee.com.

Your application, meanwhile, has been configured to send from you@yourdomain.com. The result is a message whose envelope sender and visible From address disagree, which is exactly the pattern spam filters use to identify spoofing. Even when such mail is accepted, it lands in Junk.

It also cannot be authenticated by SPF or DKIM for your domain, so DMARC will fail it.

Send through SMTP instead

SMTP authenticates with a real mailbox before sending. The message is then genuinely from that address, passes SPF and DKIM, and is delivered normally.

You need:

  1. A mailbox to send from. Create one in cPanel if it does not exist — see Create email accounts in cPanel.
  2. The server settings from Email server settings.
  3. The application configured to use them.

Use port 465 with SSL/TLS, or 587 with STARTTLS. The username is the full email address, not the part before the @.

WordPress

WordPress has no SMTP settings of its own. Install an SMTP plugin — WP Mail SMTP and FluentSMTP are both widely used — and enter the settings there. Send a test message from the plugin before assuming it works.

Laravel, Symfony and other frameworks

Set the mail transport to smtp in your environment configuration rather than sendmail or mail, then supply host, port, encryption, username and password.

Contact form and CRM applications

Most have an SMTP option in their settings. Look for "outgoing mail", "SMTP" or "mail transport" and switch it away from PHP mail or sendmail.

Mail sent through SMTP still counts towards your hourly sending limit. If your application sends a high volume of transactional mail, use a third-party SMTP relay instead, which keeps it off the shared quota entirely.

If you genuinely need PHP mail()

It can be enabled on request, but you will inherit the deliverability problems described above. See Enable PHP mail on your account.

Verify

  • The application's own test-email function succeeds.
  • The message arrives in the inbox rather than Junk.
  • The message headers show your domain in the envelope sender, not the server hostname — see Read email headers.

On this page

Hosted elsewhere?

Cloud Hosting

cPanel on NVMe storage, with LiteSpeed, free SSL and daily backups included.

See plansFree migration