On this page
What this issue is
Many contact forms, especially custom PHP handlers and older plugins, send email with the PHP function mail(). It hands the message to the web server's local mail program (often sendmail or Exim). No login is needed, which is why it is easy to use and easy to abuse.
Because spammers abuse it, many hosts turn it off. They may list mail in disable_functions in php.ini, remove the sendmail binary, cap messages per hour, or accept the message and then discard it. In each case the form usually still shows a success message. Nothing tells the visitor, or you, that the email was lost.
Why it costs you leads or sales
The visitor did everything right: they filled in the form and saw a thank-you page. You never get the enquiry, so nobody replies. They assume you ignored them and go to a competitor. Because there is no error, this can run for weeks before anyone notices a quiet inbox.
- Visitor submits formPage shows a thank-you message
- Handler calls mail()Host blocks or drops the message
- Email to inboxNever arrives
- Your replyNever happens
The form works on screen, but the email never leaves the server.
Example: 40 people submit the form each week, but only the few emails that slip through reach you.
How to check if your site has it
Submit a real test lead
Use an address you control, ideally at a different domain from your site. Wait 10 minutes and check inbox, spam and junk.
Check whether mail() is disabled
Look at phpinfo() or your host's PHP settings for
disable_functions. Ifmailis listed, it is blocked.Test mail() directly
Upload the snippet below, open it once in your browser, then delete it. A false result means PHP could not hand the message over. A true result only means it was accepted, not delivered.
Read the server mail log
In your hosting panel look for mail logs or Track Delivery. Messages marked rejected, deferred or limit exceeded point to a host block.
<?php
$to = 'you@example.com';
$ok = mail($to, 'mail() test', 'Test from the server', 'From: test@yourdomain.com');
var_dump($ok);
var_dump(ini_get('disable_functions'));How to fix it
The reliable fix is to stop using bare mail() and send through an authenticated service: your domain's mailbox over SMTP, or a transactional email provider's SMTP or API. Then add SPF, DKIM and DMARC records so receivers trust the mail.
Install an SMTP plugin
Use an SMTP or email-API plugin such as WP Mail SMTP or FluentSMTP.
Enter your mail provider details
Choose your provider or Other SMTP, then add host, port, encryption and credentials. Use an address on your own domain as the From email.
Send the plugin's test email
Then submit your real form. Form plugins like Contact Form 7 and Gravity Forms use wp_mail(), so they pick up the change.
Replace mail() with a mail library
Install PHPMailer or Symfony Mailer with Composer, or call your email provider's API.
Use authenticated SMTP
Set host, port 587 with STARTTLS (or 465 with SSL), username and password. Keep credentials in environment variables, not in the code.
Check the result
Handle send errors and log them, and only show the thank-you message when sending succeeds or the lead is saved.
Know the limit
GTM does not send form emails. The fix lives in the form handler or your form tool's notification settings.
Check native form notifications
Webflow forms do not use your host's mail(). If you post to your own PHP script instead, fix that script as in Custom code.
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = getenv('SMTP_HOST');
$mail->SMTPAuth = true;
$mail->Username = getenv('SMTP_USER');
$mail->Password = getenv('SMTP_PASS');
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->setFrom('leads@yourdomain.com', 'Website');
$mail->addAddress('you@yourdomain.com');
$mail->Subject = 'New website lead';
$mail->Body = 'Name: ' . strip_tags($_POST['name'] ?? '');
$mail->send();
} catch (Exception $e) {
error_log('Mail failed: ' . $mail->ErrorInfo);
}Add SPF
Add your sending provider to the domain's SPF TXT record. Keep only one SPF record.
Turn on DKIM
Publish the DKIM record your provider gives you in DNS.
Add DMARC
Publish a DMARC record, starting with p=none to monitor.
Add a backup
Also save each lead in a CRM or database, so a mail failure never loses the enquiry.
mail() on the host
- No login, easy to block
- Silent failures
- Often lands in spam or vanishes
Authenticated SMTP or API
- Signed with SPF and DKIM
- Errors are reported
- Delivery you can verify
How to confirm it's fixed
- A test lead arrives in the inbox within a few minutes
- The message is not in spam
- The From address is on your own domain
- SPF, DKIM and DMARC pass in the message headers
- The lead also appears in your CRM or database
- The temporary mail-test.php file is deleted
How to prevent it happening again
Hosts change mail rules, migrations reset PHP settings, and mail credentials expire. Keep a record of how forms send mail, store leads somewhere besides email, and test the full path on a schedule instead of waiting for a customer to complain.
Day 0
Host moves the site or tightens mail rules
Day 1
Forms still show success, emails stop
Day 14
Someone notices the inbox is oddly quiet (example timing)
Day 15
Sending moved to SMTP, test lead arrives
How FunnelGuard handles this
FunnelGuard detects this today. Its robot visitor fills in and submits your real lead form on a schedule, then checks whether the test lead actually reaches the inbox and CRM. When the form succeeds on screen but the email does not arrive, the check reports delivery_failed.
A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause. FunnelGuard tells you delivery failed; it does not read your server config, so use the steps above to confirm that mail() is the reason. Test submissions are marked with utm_source=funnelguard and fg_test=1. The Free plan covers 1 site and 2 journeys with daily checks and no card.
The visitor sees success, but the email never reaches you.
Questions people ask
Why is my contact form not sending emails?
A common cause is that your host blocks or drops PHP's mail() function. The form still shows a success message, but the email never leaves the server. Send through authenticated SMTP or an email API instead, then submit a test lead to check.
How do I know if my host has disabled mail()?
Check disable_functions in phpinfo() or your host's PHP settings for the word mail. You can also check your host's mail logs for rejected or deferred messages. The only proof of delivery is a test email arriving in a real inbox.
Why does mail() return true but no email arrives?
mail() returns true when the local mail program accepts the message, not when it is delivered. The host or the receiving server can still drop it, for example for a missing SPF or DKIM record or a sending limit.
How do I replace PHP mail() with SMTP?
Use a library such as PHPMailer, or an SMTP plugin on WordPress. Enter your mail provider's host, port 587 with STARTTLS, and credentials, and use a From address on your own domain. Then send a test.
Do I need SPF, DKIM and DMARC for form emails?
Yes. These DNS records prove your mail is genuine. Without them, form emails often land in spam or are rejected, even when sent through SMTP.
Can I rely on email alone to receive leads?
It is safer not to. Also store each submission in a CRM or database so a mail failure does not lose the lead. Then email is a notification, not the only copy.
How can I detect when form emails stop arriving?
Run a scheduled test that submits the form and checks the email arrives. FunnelGuard does this with a robot visitor and alerts you when delivery fails, with a screenshot and a likely cause.
Related issues
- OPS-082Outbound SMTP port blocked by hostFix guide
- OPS-080Cron / scheduled tasks not running (emails, abandoned cart)Fix guide
- OPS-078PHP upgrade breaking plugins/formsFix guide
- OPS-072Server out of disk space (uploads, sessions fail)Fix guide
- OPS-092Hosting migration left old server serving some trafficFix guide
- OPS-073Memory / PHP memory_limit exhausted (white screen)Fix guide