How we test WordPress contact forms like a visitor (and confirm the email actually arrives)
A contact form is the most important page on a lot of small business sites, and it's the one nobody checks. The page loads. The form renders. Everything looks fine. Meanwhile the notification email has been going nowhere
A contact form is the most important page on a lot of small business sites, and it's the one nobody checks. The page loads. The form renders. Everything looks fine. Meanwhile the notification email has been going nowhere for three weeks.
I run an agency with about 50 client sites, and I'm the founder of WP Foreman, a WordPress management tool. This is how form testing works in it, why it checks what it checks, and where it stops. If you'd rather build your own version with a script and a mail catcher, the same checks apply.
Why "the form loads" is not a test
There are two separate things that have to work:
- The form submits. The visitor fills it in, clicks send, and sees the thank-you message.
- The email arrives. The site sends a notification to whoever needs it, and it lands somewhere a person can see it.
Most uptime and monitoring checks stop at "the page returns 200". Neither of the above is covered by that. Both fail regularly, and for different reasons:
- A plugin or theme update changes the markup or a field, and submission starts erroring.
- The mail setup stops working (an SMTP credential rotates, a sending domain's DNS changes) and the form still shows a cheerful thank-you.
- A spam filter starts catching legitimate submissions.
The second one is the nasty one, because from the visitor's side nothing looks wrong. You only find out when a client asks why they haven't had an enquiry.
The test, step by step
In WP Foreman, you open a site, go to Form testing, and it lists the forms it found along with the pages they're on. You tick the ones that matter (usually the contact and quote forms) and pick the page the test runs on. It works with Gravity Forms, WPForms, Contact Form 7 and Fluent Forms.
A test then does what a visitor does:
- Fill in the form. Required fields get test details.
- Submit it. The thank-you message has to appear. A validation error or an error message fails the test.
- Wait for the email. Each email the form sends is caught, along with how long it took and whether it passed SPF, DKIM and DMARC, which are the checks that decide whether a message gets treated as legitimate or lands in spam.
That last part matters more than it sounds. "An email was sent" and "an email arrived somewhere it will be read" are different claims.
The slow-email case
Some forms hand the email off to a background job and send it a minute or two later. If a test judged the result the moment the page responded, those would all look like failures. So the result shows "Sent. Waiting for the email…" for up to 10 minutes before it decides. If you write your own version, build the wait in.
What the test must not do
A test that submits real forms has a few ways of being a nuisance, so these are the guardrails:
- No real email goes out unless you ask for a copy. By default the result just shows who the email would have gone to. If you do want a copy, it carries a [WP Foreman test] subject so nobody mistakes it for a lead.
- No outside services are called. CRMs, Zapier, mailing lists and webhooks are skipped during a test and listed in the result, so a test doesn't add a fake contact to a client's list.
- The test entry is deleted, so it doesn't count as a lead or clutter the form's entries.
If you're rolling your own, be most careful here. A test that adds 52 fake contacts a week to a client's CRM won't make you popular.
When to run it
Two schedules matter:
- On a timer. Weekly by default, or daily, or off if you only want to run it by hand.
- After updates. A few minutes after WP Foreman updates the site, the ticked forms are tested again, because an update is the usual reason a form breaks. A form tested in the last 30 minutes is skipped, so you don't get a pile of repeat tests.
The after-update run is the one I'd keep even if I turned everything else off. It turns "I updated 50 sites on Tuesday night" into "and I know the forms still work".
Failed versus couldn't test
One small distinction I'm glad we made: a test that couldn't run at all (the site was down, or the tool couldn't reach it) shows as "Couldn't test" and does not count as the form failing. Otherwise a short outage would send a "your form is broken" alert for a form that is fine, and people stop trusting alerts that cry wolf.
When a scheduled or after-update test does fail, everyone on the account gets one email, and one more when it works again. It doesn't repeat while it stays broken. A failing form is also listed under "Needs you" in the morning report until it passes, it's logged in the site log (every change from working to failing and back), and it can be a trigger for a rule, for example to post to a webhook.
Turning it into something a client can see
The results also feed the client report, in a section called "Forms, tested like a visitor". It shows how many tests ran in the period and how many went through, and for each form its page, tests, passes, latest result and how quickly the email arrived. The line at the top reads something like "We tested your 2 forms 8 times, and every test went through, email included." If the latest test failed, the form is also listed under Needs attention.
For an agency, that one line is the useful part. It's evidence that the thing the client cares about most is working, in language they don't need translating.
Honest limits
- It supports four form plugins: Gravity Forms, WPForms, Contact Form 7 and Fluent Forms. If a client uses something else, it won't test it.
- Forms inside popups, widgets or page builder templates aren't found yet. For those, it won't list the form.
- It needs the WP Foreman plugin (0.9.0 or newer) on the site.
Disclosure and the Black Friday deal
I'm the founder of WP Foreman (https://wpforeman.com). The first site is free with every feature, then it's $1.99 per site per month. For Black Friday there are two options: a lifetime deal that opens Sunday Nov 22 at 7 PM ET and closes Nov 30 at 11:59 PM ET (150 slots; 25 sites $199, 50 sites $349, 100 sites $599, 250 sites $899; 30-day refund), or 50% off the first 3 months with the code BF2026. The details are at https://wpforeman.com/black-friday/.
If you test forms some other way, I'd like to hear how in the comments.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.