splitforms.com

Contact form · Flask

Contact form for Python and Flask

Add a working contact form to a Flask app without Flask-Mail, an SMTP account or a database table. Post straight from a Jinja template, or relay request.form from a Flask view with python-requests. Submissions are saved to your splitforms dashboard with spam filtering.

  • 500 free / month
  • One endpoint
  • No backend code
Flask contact form — copy-paste code for splitforms

Key benefits

No backend code

No server, API route, or SDK. Your Flask form posts straight to one endpoint.

Straight to your inbox

Every Flask submission is emailed to you and saved in a searchable dashboard, with spam filtered out first.

Design without limits

It's your own Flask markup and styles. Splitforms is only the backend, so nothing constrains how the form looks.

Copy-paste ready

Your Flask contact form, ready to paste.

Replace YOUR_ACCESS_KEY with the key from your dashboard — that's the whole integration. No SDK to install, no build step, just the html you already write.

contact.html
<!-- templates/contact.html (Jinja template rendered by Flask) -->
<!-- Posts straight to splitforms. No Flask view, Flask-Mail or SMTP needed. -->
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" />

  <label for="name">Name</label>
  <input type="text" id="name" name="name" placeholder="Your name" required />

  <label for="email">Email</label>
  <input type="email" id="email" name="email" placeholder="you@example.com" required />

  <label for="message">Message</label>
  <textarea id="message" name="message" rows="4" placeholder="Your message..." required></textarea>

  <!-- Honeypot for spam bots (hidden from real visitors) -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off" />

  <button type="submit">Send Message</button>
</form>

How to add it

How to add a contact form to a Flask website.

To add a contact form to a Flask website you need three things: a free splitforms access key, the html snippet above, and your key pasted into it. No backend, server, or SDK — the form posts to one URL and every submission lands in your inbox and dashboard.

  1. Get your free splitforms access key

    Sign up, verify your email and copy the access key you will paste into your Flask form. No credit card required.

  2. Drop the Flask snippet into your project

    Copy the Flask code example into your project and replace YOUR_ACCESS_KEY with the key from step 1.

  3. Receive submissions in your dashboard

    Submissions arrive in the splitforms dashboard within seconds. Free includes owner email notification attempts; Pro adds Slack, Discord, Sheets, or any signed webhook URL.

Where submissions go

Where do your Flask form submissions go?

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it ever reaches you. Search, export to CSV, or forward it to a webhook or Slack on Pro.

  • 500 submissions a month, free to start
  • Honeypot + automatic spam scoring on every plan
  • Signed webhooks to Slack, Discord, your server
Flask contact form submissions in the splitforms dashboard

No backend needed

Do you need a backend for a Flask form? No.

Your Flask form posts standard FormData to one URL. Splitforms validates the access key, runs its spam checks, and forwards it to your email — so there's no server, API route, or database for you to build or maintain.

  • Works from any Jinja template or relayed through a Flask view
  • No Flask-Mail, SMTP credentials or background worker to configure
  • Honeypot field plus the built-in spam filter
How splitforms processes a Flask form submission

Best practices

What a production-ready Flask form needs.

What separates a Flask form that works in a demo from one that holds up on launch day, most important first.

  • Store the access key in an environment variable when you relay through a Flask view.
  • Always pass a timeout to requests.post() so a slow network does not tie up a worker.
  • Keep the hidden botcheck honeypot field and forward it unchanged when relaying.
Production-ready Flask contact form best practices

Questions

Flask contact form questions.

Anything missing? Email us, we read every message.

A person reading answers to common questions
How do I make a contact form in Flask without Flask-Mail?

Point the form's action at https://splitforms.com/api/submit and add a hidden access_key field. Each submission is saved in your splitforms dashboard and an email notification is attempted to the form owner, so you never configure SMTP.

Can I validate the form in Flask before sending it to splitforms?

Yes. Post to your own Flask route, check request.form (or a Flask-WTF form), then forward the clean values plus access_key with requests.post().

Do I need a CSRF token when posting directly to splitforms?

No. The browser sends the form to splitforms, not to your Flask app, so Flask-WTF's CSRF check never runs. Splitforms identifies the form by its access_key.

How does spam protection work for Flask forms?

Keep the hidden botcheck checkbox in the form. Real visitors never see it; bots that fill it are flagged as spam, and splitforms' rule-based filter checks the rest of the submission too.

Read posted fields from request.form, not request.args

In a Flask view, POSTed form fields live in request.form; request.args only holds the URL query string. Use request.form.get("name", "") so a missing field gives an empty string instead of raising a 400 error.

Allow POST on the route

Flask routes answer only GET (plus HEAD and OPTIONS) by default. If you relay through your own view, declare methods=["GET", "POST"] on @app.route, or the form returns 405 Method Not Allowed.

Show 1 more questions
Flask-WTF CSRF only guards your own routes

Flask itself has no CSRF protection; extensions like Flask-WTF add it. A form that posts straight to splitforms never reaches your app, so it needs no csrf_token(). If you relay through your own view with CSRFProtect enabled, keep the token in the template.

View all FAQs

Ship your Flask contact form in 60 seconds.

Free for 500 submissions a month on your Flask site. Pro at $5/mo adds Slack alerts, signed webhooks and file uploads when you need them.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form