What is Formspree?
Formspree is a service that allows you to create functional contact forms without writing backend code. It handles form submissions and sends the data directly to your email.
Benefits:
- No backend coding required
- Spam protection included
- Email notifications
- Easy integration
Sign Up for Formspree
- Visit Formspree: Go to https://formspree.io
- Click "Get Started" or "Sign Up" button
- Create Account: Enter your email and create a password
- Verify Email: Check your email and click the verification link
- Create Form: Once logged in, click "New Form"
- Get Your Endpoint: Copy your unique form endpoint URL
https://formspree.io/f/YOUR_FORM_ID
Basic Form Structure
Here's a simple contact form structure. Replace YOUR_FORM_ID
with your actual Formspree form ID:
<form method="POST" action="https://formspree.io/f/YOUR_FORM_ID">
<div class="form-group">
<label for="name">Name</label>
<input type="text" name="name" id="name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" name="email" id="email" required>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea name="message" id="message" rows="5" required></textarea>
</div>
<button type="submit">Send Message</button>
</form>
Advanced Form Example
Here's the enhanced form from your original code with educational class names:
Live Demo Form
This form uses a placeholder endpoint. Replace with your actual Formspree URL.
CSS Styling
Add these educational CSS classes to style your form:
/* Tutorial Form Styles */
.tutorial-form {
max-width: 600px;
margin: 0 auto;
padding: 2rem;
background: #ffffff;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.tutorial-form-fields {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.tutorial-field {
display: flex;
flex-direction: column;
}
.tutorial-field-half {
flex: 1;
min-width: 250px;
}
.tutorial-field-full {
flex: 1 1 100%;
}
.tutorial-label {
font-weight: 600;
margin-bottom: 0.5rem;
color: #333;
}
.tutorial-input,
.tutorial-select,
.tutorial-textarea {
padding: 0.75rem;
border: 2px solid #e1e5e9;
border-radius: 8px;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.tutorial-input:focus,
.tutorial-select:focus,
.tutorial-textarea:focus {
outline: none;
border-color: #007bff;
}
.tutorial-submit-btn {
background: linear-gradient(135deg, #007bff, #0056b3);
color: white;
padding: 1rem 2rem;
border: none;
border-radius: 8px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s ease;
margin-top: 1rem;
}
.tutorial-submit-btn:hover {
transform: translateY(-2px);
}
Implementation Steps
Follow these steps to implement your form:
Tips & Best Practices
Spam Protection
Formspree includes built-in spam protection. You can also add a honeypot field for extra security.
Mobile Responsive
Always test your forms on mobile devices. Use flexible layouts and appropriate input types.
Form Validation
Use HTML5 validation attributes like 'required', 'type="email"', and 'pattern' for better user experience.
Custom Thank You Page
Create a custom thank you page and redirect users after form submission for better UX.