HTML form to email
How do I send an HTML form to email without PHP?
By the FormToMail team · Checked against official sources · Updated
Without PHP you post the form to a service that sends the email for you: either a hosted form endpoint (paste its URL into action) or your own serverless function that calls an email API. Both work on static hosts like GitHub Pages, Netlify, Vercel or Cloudflare Pages, where PHP doesn't run.
| Option | What you write | Best for |
|---|---|---|
| Hosted form endpoint | Only HTML | Static sites, AI-built sites, no-code |
| Serverless function (Cloudflare, Vercel, Netlify) | JavaScript + email API key on the server | Developers who want control |
| mailto: link | Only HTML | Personal pages where a visible email is fine |
The HTML-only version
<form action="https://getformtomail.com/f/YOUR_FORM_ID" method="POST">
<label>Name <input name="name" required></label>
<label>Email <input name="email" type="email" required></label>
<label>Message <textarea name="message" required></textarea></label>
<!-- honeypot: real people never see or fill it -->
<input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<button type="submit">Send</button>
</form>Why not send email from JavaScript in the browser?
Browsers can't speak SMTP, and an email API key in front-end code can be copied by anyone and used to send spam from your account. The sending has to happen on a server: a form endpoint is a server someone else runs for you.
Quick answers
HTML form to email script?
You don't need one: the endpoint is the script. Paste its URL as the action.
Can I use a form backend with a React single page app?
Yes, with fetch(). See React contact form without a backend.
How do I use Resend or SendGrid for a contact form?
Call their API from a serverless function with the key stored as a server secret; never from the browser.
What to do next
Skip the server: create a free endpoint and paste it in.
Get your form endpointSources
Checked: . Prices, limits and features of other services change: confirm current values at the official links above. Product names belong to their owners; we are not affiliated with them.