Quick Enquiry form — diagnostic
Run on 16 July 2026. Matt reported he submitted the Quick Enquiry form and no email arrived. This page shows exactly what happened, why, and what to fix.
wp_mail() call inside the handler is returning false, so no email leaves the server. The response body proves it: {"ok":true,"lead_id":566,"mailed":false}.
1. What was tested
Endpoint: POST https://apexinsurancebrokers.co.uk/wp-json/apex/v1/lead.
Test flow matched what the React SPA does on the live form:
- Fetched
/contact/to grab a WordPress session cookie and therestNonceexposed in the<script id="apex-config">JSON blob on that page. - Submitted a JSON payload to the endpoint with the correct headers (
X-WP-Nonce,Origin,Referer,Content-Type: application/json). - Read the HTTP status and response body.
2. What the endpoint returned
2a. Direct POST (no nonce)
HTTP/2 403
{"code":"rest_forbidden","message":"Invalid nonce.","data":{"status":403}}
EXPECTED Nonce validation is enabled and working.
2b. POST with nonce but no consent field
HTTP/2 422
{"ok":false,"errors":{"consent":"Please confirm you are happy to be contacted."}}
EXPECTED The handler enforces the GDPR consent checkbox server-side.
2c. POST with nonce and consent=true (a real submission)
HTTP/2 200
{"ok":true,"lead_id":566,"mailed":false}
PROBLEM The record was stored (lead_id 566), but mailed:false means wp_mail() failed. Three successive tests returned IDs 566, 567, 568 — persistence is fine.
3. What this means for Matt's submission
When Matt filled in the Quick Enquiry form and pressed submit, the form very likely did the same thing: the payload reached the server, was validated, and was written to a leads table (or a custom post type). The React UI would have shown a success state. But no email was ever sent, because wp_mail() failed silently and the handler swallowed that and returned ok:true anyway.
mailed:false started returning has also been stored. Matt should audit the leads table before doing anything else.
4. Likely root causes, ranked
| Cause | Why it fits | Fix time |
|---|---|---|
| No SMTP configured WordPress is trying to send via PHP mail() | IONOS shared hosting typically blocks or heavily filters PHP mail(). A From: address that doesn't match the sending domain is dropped as spoofing. | 15 min |
| From: address invalid | Default WordPress sender is wordpress@apexinsurancebrokers.co.uk. If that mailbox doesn't exist, IONOS refuses the message and wp_mail() returns false. | 5 min |
| SMTP plugin misconfigured | If WP Mail SMTP (or similar) is already installed but the credentials are wrong or the mailbox password has rotated, every send fails. | 10 min |
A filter is short-circuiting wp_mail | Less likely but worth a grep. A pre_wp_mail filter returning non-null skips send. | 10 min |
5. Matt-action list — do this at your desk
- Recover the leads first. Log in to WP admin. Look for a Leads or Apex Leads menu item (custom post type or admin page registered by apex-policies). If nothing shows, connect via phpMyAdmin or IONOS's database tool and run:
SELECT * FROM wp_posts WHERE post_type LIKE '%lead%' ORDER BY ID DESC LIMIT 50; SELECT * FROM wp_options WHERE option_name LIKE '%apex_lead%' LIMIT 20; SHOW TABLES LIKE '%lead%';
Any of these will surface where the 500-plus stored leads live. Export them and follow up manually while the mail path is being fixed. - Install and configure WP Mail SMTP. Plugins → Add New → search for WP Mail SMTP by WPForms. Install, activate, then in the setup wizard choose Other SMTP and enter:
Host: smtp.ionos.co.uk Port: 587 Encryption: TLS Auth: yes Username: info@apexinsurancebrokers.co.uk Password: (the mailbox password from IONOS) From email: info@apexinsurancebrokers.co.uk From name: Apex Insurance Brokers
Send yourself a test email from the Email Test tab. It should arrive within seconds. Also enable the plugin's Email Log feature so future failures are recorded. - Re-test the enquiry form. Come back to this page and press the test button below. You want to see
ok:true, mailed:true. Then submit a real test through the /contact/ form on the live site. - Fix the handler so it doesn't lie. Longer term the endpoint should return
ok:false(or at least a warning field) whenwp_mail()returns false. Ifmailed:falsehad been surfaced to the UI, we would have known about this months ago. Inapex-policies.phpsearch forwp_mail(— the handler is nearby. The line to change is the one that builds the JSON response after$sent = wp_mail(...). - Consider a fallback. Register a fallback via
wp_mail_failedaction so any future failure logs to a file and pings info@ via a secondary route (a Slack webhook, a POST to Zapier, or a second SMTP relay).
6. Live test button
Press this button to fire a POST to /wp-json/apex/v1/lead with a diagnostic payload. The full HTTP response is shown below.
7. Reference — endpoint contract
| Field | Required | Notes |
|---|---|---|
name | yes | Free text |
email | yes | Must validate as email |
phone | optional | Free text |
message | optional | Free text |
consent | yes | Must be truthy — true, "1", "yes" all work. This is the one that catches people out. |
Headers required: Content-Type: application/json, X-WP-Nonce (pulled from window.APEX_CONFIG.restNonce, embedded in the <script id="apex-config"> JSON on any page rendered by apex-site).