
A custom form-testing client can send a request that looks like multipart data but arrives with missing fields or an unreadable file. One cause is a Content-Type header that says multipart/form-data without the boundary matching the actual body. Diagnose that framing problem before changing Contact Form 7 mail settings or raising upload limits.
The ordinary Contact Form 7 browser workflow should remain responsible for submitting its form. This guide is for developers inspecting an authorized test client or a separate lead relay. The example below only constructs a local Request object and does not submit a form, send email or contact a CRM.
Understand what the boundary does
A multipart body carries separate parts, such as text fields and file bytes. The boundary parameter in its Content-Type header tells the receiver how to find the separators. The separators in the body and the declared boundary must agree.
The multipart/form-data specification describes that format and each part’s Content-Disposition. The Content-Type reference also identifies boundary as required for multipart entities. A field named boundary inside the form is not a replacement for the header parameter.
Think of the body and its header as one encoded representation. If middleware replaces the body while forwarding an old Content-Type header, it can break a request that previously parsed correctly. Matching field names alone does not prove the new representation remains valid.
Let FormData generate the matching header
MDN’s FormData guide warns against explicitly setting Content-Type when sending FormData with Fetch or XMLHttpRequest. The browser needs to supply its own multipart boundary. Remove a generic JSON header from that request as well.
This local-only browser example uses synthetic values and a reserved example domain. Constructing the request lets you inspect its generated header. There is deliberately no fetch call.
const payload = new FormData();
payload.append('inquiry_id', 'fixture-001');
payload.append('message', 'Synthetic inquiry');
payload.append('sample_file', new Blob(
['Fixture only'], { type: 'text/plain' }
), 'fixture.txt');
const request = new Request('https://example.invalid/intake', {
method: 'POST',
body: payload
});
console.log(request.headers.get('content-type'));
// multipart/form-data; boundary=... generated by the client
Do not copy the generated boundary into a permanent configuration value. A different request can use a different boundary. Likewise, do not stringify FormData as JSON and expect the result to retain file bytes or repeated multipart fields.
Inspect the actual request representation
In a controlled test environment, compare the request’s content type with the payload shown by the network inspector or test receiver. Confirm the expected text fields are present, the file has its expected byte length, and the closing multipart delimiter is intact.
If the Content-Type is application/json while the body contains multipart delimiters, inspect shared client defaults. If it is multipart/form-data without a boundary, inspect manually assigned headers. If a boundary exists but parsing still fails, inspect the relay or encoder that assembled the body.
Use small synthetic files and short fixture messages. Request captures may contain complete inquiry content and credentials, so keep them private and short-lived. A diagnostic record usually needs the media type, field names, byte counts and parsing outcome rather than a permanent copy of real uploads.
Choose one relay strategy
A byte-preserving relay forwards the original encoded body with the headers needed to describe those bytes. A reconstructing relay parses the input, validates allowed fields and creates a fresh multipart body with its own encoder. Those are different approaches, and their headers cannot be mixed casually.
For the reconstructing approach, let the chosen HTTP library generate the outbound multipart content type. Preserve repeated values intentionally rather than flattening them into a single string. The multi-select payload guide explains why losing repeated choices changes a lead’s meaning.
Do not copy browser cookies or credentials into an external relay by default. The receiving service needs its own authentication contract. A correctly framed multipart request still requires authorization, field validation and an explicit rule for retaining or discarding files.
Keep parsing, file acceptance and delivery separate
Successful multipart parsing only establishes that the receiver could read the representation. Contact Form 7 can still reject a file by type or size. Its file attachment documentation also separates adding an upload field from attaching that field in the mail configuration.
If a small file parses and a larger one fails, investigate the request and upload size limits. Do not call every upload failure a boundary error. Preserve the distinction between an HTTP rejection before WordPress, a form validation response and a mail failure after validation.
The documented DOM events describe several submission outcomes. A generic completed submission event does not prove mail success or CRM processing, and mail success does not prove inbox delivery. A separate relay needs its own receipt and reconciliation status.
Use a focused regression fixture
Retain an offline or private test covering a plain text field, a repeated field and a tiny file. Assert that the receiver sees the expected parts. Add a deliberately missing-boundary case and confirm the test reports parsing failure rather than recording a successful lead.
Our free Svetlik Analytics for Contact Form 7 provides WordPress submission trends. It does not replace the transport checks for a custom relay. Repair the representation, verify the application outcome and keep each status visible in the workflow that owns it.
