Limited-time offer The first 2,000 users get 10,000 emails/month free forever 2,000 of 2,000 spots left Claim yours

Guides

How to send email from a static website (no backend)

Static sites can’t run server code, so they can’t talk to an SMTP server directly. Here are your options, and the five-minute one.

Last updated October 25, 2026

Your options

ApproachGoodNot so good
mailto: linkZero setupOpens the visitor’s mail app; many visitors don’t have one set up, and you get no form data.
Serverless function (Netlify/Vercel functions)Full controlYou write, deploy and secure backend code, and store SMTP secrets on the platform.
Hosted form backendNo codeMost cap free plans at 25–250 submissions and send from their own domain.
FormSMTP (form backend using your SMTP)No code, 1,000 emails/month free, sent from your own addressYou need an email account with SMTP access (nearly all have one).

How it works

Your form posts to a FormSMTP URL. FormSMTP checks the request (allowed site, rate limit, spam honeypot), then hands the message to your SMTP server, the same one your mail app uses. The email arrives from your own address, with the visitor as reply-to.

1Create a FormSMTP project

Sign up free and add a project. Pick your email provider so the SMTP host and port fill in, enter your login, and click Test connection. Not sure which provider? Your existing mailbox works: see the Gmail or Zoho guides.

2Lock the project to your site

In Settings → Security, set Allowed websites to https://yoursite.com and Allowed recipients to your own address. Now the key in your page can only email you, only from your site, and only up to your hourly limit.

3Add the form

Paste this anywhere in your HTML and replace YOUR_API_KEY with the key from API & code:

html
<form action="https://app.formsmtp.com/api/v1/form/YOUR_API_KEY" method="POST">
  <label>Name <input name="name" required></label>
  <label>Email <input name="email" type="email" required></label>
  <label>Message <textarea name="message" rows="5" required></textarea></label>

  <input type="hidden" name="_subject" value="New message from my website">
  <!-- Honeypot: hidden from people, irresistible to bots -->
  <input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">

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

Submit it once. The message lands in your inbox and shows up under Logs.

4Optional: send without leaving the page

Prefer an inline “Thanks!” message? Submit with fetch() and ask for JSON:

html
<script>
  const form = document.querySelector("form");
  form.addEventListener("submit", async (e) => {
    e.preventDefault();
    const res = await fetch(form.action, {
      method: "POST",
      headers: { Accept: "application/json" },
      body: new URLSearchParams(new FormData(form)),
    });
    const data = await res.json();
    form.innerHTML = data.success ? "<p>Thanks! We'll be in touch.</p>" : "<p>Sorry: " + data.error + "</p>";
  });
</script>

Framework guides

FAQ

Can a static website send email without a server?

Not by itself, because browsers can’t speak SMTP. A form backend like FormSMTP receives the form over HTTPS and sends the email for you, through your own SMTP account, so you don’t run a server.

Does this work on GitHub Pages, Netlify and Vercel?

Yes. It’s a plain HTML form (or a fetch call), so it works on any host, including Cloudflare Pages, Firebase Hosting, S3 and Framer or Webflow custom code.

Is it safe to put the API key in my HTML?

Yes, with the project locked down. Form submissions always go to your own inbox, and you can restrict the key to your website and an hourly limit, so a copied key can’t be used to email anyone else.

Why did my message land in spam?

Usually the From address and the SMTP account don’t match, or the domain has no SPF/DKIM records. Send from the address you log in with, and check the Deliverability panel in FormSMTP’s Settings.

More guides

Ship your form in five minutes

Connect the SMTP account you already have, copy one snippet, done. Free, no card.