Skip to content
Every tutorial here is 100% free — and always will be
Website Buildsbeginner

Set Up a Contact Form With Email Notifications

Stores the submission first, then emails a notification and a confirmation — so a failed email never loses the lead.

When to use it

Lead capture

Lovable Prompt
Add a contact form to this project.

Fields: name (required), email (required, validated), subject, message (required).

Behaviour:
- Validate on the client and again on the server.
- Save every submission to the database first.
- Only after saving, send a notification email to the site owner and a confirmation email to the person who submitted.
- If email sending fails, still keep the saved submission and log the failure — do not show the user a false error.
- Show explicit loading, success and error states.
- Add basic abuse protection: a honeypot field and a simple rate limit per address.

Do not display any email address publicly anywhere in the interface.

Why it works

Saving before sending makes the flow resilient, and stating the failure behaviour prevents a misleading success message.

Guides that use this prompt

Website made, maintained and hosted by PromptSites.com

PromptSites logo