Every enquiry sends two emails and the client gets a reply-to
The contact form on every service page sends two emails through a single API call. The first goes to me — subject line tagged with the service name in square brackets, body containing every field the client filled in, reply-to set to the client's email so I can respond directly from my inbox. The second goes to the client — a plain text confirmation that their enquiry was received, a one-to-two working day response estimate, and a reply-to pointing back to my personal email. Two emails, two directions, one API route. The service-specific formatting is handled by a formatServiceFields function that iterates over every key in the request body, skips the standard fields — name, email, message, service, website — and formats the rest as labelled lines. The key is converted from snake_case to Title Case with a regex replacement. If the client filled in genre, track_count, and project_type on the audio intake form, the email reads Genre, Track Count, and Project Type followed by their values. The message field gets its own section at the bottom with a blank line above it. The subject line adapts to the service — [Sound Engineering] New enquiry from Sarah or [Accessibility Consulting] New enquiry from David. If no service is specified, the subject falls back to Contact from followed by the name. The honeypot check runs before any validation. Same pattern as the newsletter — if the invisible website field has a value, the API returns success without sending anything. Five services, five different intake form configurations, one API route, two emails per enquiry.
Comments coming soon
Sign in with TikTok to leave a comment. Coming soon.