DIAGNOSTIC | INTERNAL USE ONLY | NOT INDEXED
Apex Insurance Brokers Limited
apexinsurancebrokers.co.uk
FRN 724952

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.

Headline. The form endpoint is working. Submissions are being stored in the database (lead IDs are auto-incrementing correctly). But the 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:

  1. Fetched /contact/ to grab a WordPress session cookie and the restNonce exposed in the <script id="apex-config"> JSON blob on that page.
  2. Submitted a JSON payload to the endpoint with the correct headers (X-WP-Nonce, Origin, Referer, Content-Type: application/json).
  3. Read the HTTP status and response body.

2. What the endpoint returned

2a. Direct POST (no nonce)

Response
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

Response
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)

Response
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.

The good news. The lead is not lost — it is stored in the WordPress database. Every real customer enquiry submitted through this form since mailed:false started returning has also been stored. Matt should audit the leads table before doing anything else.

4. Likely root causes, ranked

CauseWhy it fitsFix 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 invalidDefault 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 misconfiguredIf 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_mailLess 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

  1. 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.
  2. 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.
  3. 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.
  4. Fix the handler so it doesn't lie. Longer term the endpoint should return ok:false (or at least a warning field) when wp_mail() returns false. If mailed:false had been surfaced to the UI, we would have known about this months ago. In apex-policies.php search for wp_mail( — the handler is nearby. The line to change is the one that builds the JSON response after $sent = wp_mail(...).
  5. Consider a fallback. Register a fallback via wp_mail_failed action 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

FieldRequiredNotes
nameyesFree text
emailyesMust validate as email
phoneoptionalFree text
messageoptionalFree text
consentyesMust 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).