How-To Guide · November 3, 2026
How to Prompt AI to Build a Contact Form That Actually Works
How to prompt AI builders like Lovable, Bolt, and v0 for a contact form that saves leads, emails the owner, blocks spam, and passes a real test.

TL;DR
- AI website builders often make a contact form that shows "Message sent!" but sends nothing. Always test it on the live site.
- Prompt for the whole flow: save each submission to a database table, then email the owner through a service like Resend from a server function, with the API key stored as a secret.
- Ask for real success and error states, a honeypot field and rate limiting for spam, and a confirmation email to the customer if you want one.
- Test it: open DevTools, go to Network, submit once, and confirm the message actually lands in the inbox.
For a local business, the contact form is where the leads come from. If it's broken, the owner just thinks the website "doesn't work." Here's how to prompt an AI builder like Lovable, Bolt, or v0 so the form actually delivers.
1. Know why AI contact forms break
When you ask for "a contact section," the AI usually builds the fields and a success toast, and that's it. Nothing tells it where the message should go. A test of 105 Lovable and Bolt sites found 27 showed a success message without sending anything. When there is an email step, the common failures are a missing API key, the sender still set to Resend's test address (which only delivers to the account owner), or a sending domain that was never verified.
2. Prompt for the full flow, not just the form
Be specific about where data goes. A prompt that works:
"Build a contact form with name, phone, email, and message (all required, validated). On submit, save the entry to a 'contacts' table in Supabase, then call an edge function that emails the submission to owner@business.com using Resend. Store the Resend API key as a secret, never in frontend code. Only show 'Message sent' after the server returns success; otherwise show an error with the business phone number."
Saving to a table first means no lead is lost even if an email fails.
3. Add spam protection in the same prompt
Local business forms get bot spam fast. Add:
"Add a hidden honeypot field and silently drop any submission that fills it. Drop submissions sent less than 3 seconds after the page loads, and limit each IP to 3 submissions per hour."
4. Finish the email setup outside the AI
The AI can write the code, but you still have to create the Resend account, add the API key, and verify the client's domain with DNS records. Then prompt: "Update the From address to contact@[clientdomain].com and redeploy the function." Skipping this step is one of the most common reasons nothing arrives.
5. Test it like a customer
On the published site, press F12, open the Network tab, and submit once. If no request carries what you typed, the form is fake. If the request fails, paste the error into the chat and ask the AI to fix that exact error. If the AI keeps going in circles, use a focused follow-up prompt or ask it to delete the form and rebuild it from scratch.
What Reddit users reported
- One r/lovable user said they kept entering their email and were told notifications were activated, but test submissions never arrived (thread).
- In another r/lovable thread, a builder said they've had zero issues with forms using a Supabase table plus an edge function that sends a Resend email on each new row, and that it takes maybe 20 minutes to wire up (thread).
- In that same thread, someone shared a prompt that saved contacts to a database with an /admin/contacts page and Telegram alerts, and said it completed the form with 5 credits (thread).
- A commenter in an r/lovable help thread said their form emails both the user and the admin and keeps a lead backup in the database, for free (thread).
Why this matters when you sell websites
A form that quietly drops leads makes your work look bad, even if the design is great. Test it before handoff and show the owner a real test lead arriving. Our guide to writing an AI website builder prompt covers the rest of the build, and Locasly helps you find local businesses with weak websites to pitch in the first place.
FAQ
Why does my AI-built contact form say "Message sent" but I get no email?
Usually the submit button only shows a success message and sends nothing. If it does send, the email step is failing because of a missing API key, an unverified domain, or a test sender address.
How do I stop contact form spam without a CAPTCHA?
Ask the AI for a honeypot field, a minimum fill time, and rate limiting. Add Cloudflare Turnstile if spam still gets through.
Steps at a glance
- Know why forms break
AI often builds a success toast with no backend.
- Prompt the full flow
Save to a table, email via a server function, key as a secret.
- Add spam protection
Honeypot, minimum fill time, rate limit.
- Finish email setup
Add API key, verify domain, update From address.
- Test on the live site
Check the Network tab and the inbox.