MailSlurp logo

Send HTML Form Submissions to Email (No Backend Required)

Build HTML forms that send submissions to email with hidden routing fields, redirect behavior, file uploads, and anti-abuse safeguards.

Use with your tools

Static sites still need contact and lead-capture forms. This guide shows how to submit HTML form data directly to email without managing your own backend endpoint.

Quick answer: how does form-to-email work?

  1. Your browser posts form data to a form endpoint.
  2. Routing fields (such as _to) define where the submission goes.
  3. The platform converts submission data into a delivered email.
  4. Optional fields choose a thank-you page or success message for the visitor.

1) Start with a valid HTML form

Use method="post" and a correct action URL:

<form action="https://api.mailslurp.com/forms" method="post">
  <input name="name" placeholder="Your name" required />
  <input name="email" type="email" placeholder="you@company.com" required />
  <textarea name="message" placeholder="How can we help?" required></textarea>
  <button type="submit">Submit</button>
</form>

2) Add a hidden destination field

<form action="https://api.mailslurp.com/forms" method="post">
  <input type="hidden" name="_to" value="support@example.com" />
  <input type="hidden" name="_subject" value="New contact form submission" />
  <input name="name" placeholder="Your name" required />
  <input name="email" type="email" placeholder="you@company.com" required />
  <textarea name="message" placeholder="How can we help?" required></textarea>
  <button type="submit">Submit</button>
</form>

_to tells MailSlurp where to deliver the submission email.

3) Configure post-submit behavior

Use _redirectTo to send users to a thank-you page:

<input type="hidden" name="_redirectTo" value="https://example.com/thanks" />

Or show inline success text:

<input type="hidden" name="_successMessage" value="Thanks - we received your request." />

4) Support file uploads

Add enctype="multipart/form-data" plus file inputs:

<form action="https://api.mailslurp.com/forms" method="post" enctype="multipart/form-data">
  <input type="hidden" name="_to" value="support@example.com" />
  <input name="email" type="email" required />
  <input name="attachment" type="file" />
  <button type="submit">Submit</button>
</form>

5) Add anti-abuse controls before going live

Serverless form endpoints can attract spam. Minimum controls:

  • Add a honeypot field and drop submissions when populated
  • Add rate limits at CDN/WAF layer
  • Require required fields and strict input lengths
  • Route suspicious patterns to moderation inboxes

Form-to-email vs API+webhook pipeline

Use case Best fit
Basic contact forms on static pages Form-to-email endpoint
Structured workflows with retries and routing logic API + webhook automation
Audit-heavy enterprise intake API + storage + workflow orchestration

Operational checklist

  1. Validate _to and subject routing in staging.
  2. Confirm success/redirect behavior for mobile and desktop.
  3. Test file upload paths and attachment visibility.
  4. Run spam and deliverability checks before launch.
  5. Add monitoring for submission volume anomalies.