Free plan250 submissions a month, spam filtering included, no card.See pricing →
Guide · HTML

Send an HTML form to email without running a server

People try mailto:, then a PHP mail() script, then Google Apps Script, and each has a catch. Below is the honest comparison, then the approach that works for any HTML contact form on any host, including static ones, followed by a complete, accessible example you can paste today.

5 min readWorks on any hostLast reviewed

On this page

Your options, compared

Four ways people try to get form submissions into their inbox. Only one works on a static host without code you have to maintain.

ApproachStatic hostsDelivers reliablySpam protectionUpkeep
mailto: linkYesNo, opens the visitor’s mail appNoneExposes your address
PHP mail() scriptNo, needs PHPCan land in spamYou build itServer and patches
Google Apps ScriptYesDaily quota limitsYou build itScript and quotas
Form endpointYesYes, authenticated sendingBuilt inNone

The minimal integration

This is the whole thing: a normal HTML form whose action points at your endpoint. No JavaScript required. The browser posts it and lands on a success page.

HTML
<form action="https://mtform.co/f/your-form-key" method="POST">
  <label>
    Name
    <input name="name" autocomplete="name" required>
  </label>

  <label>
    Email
    <input type="email" name="email" autocomplete="email" required>
  </label>

  <label>
    Message
    <textarea name="message" required></textarea>
  </label>

  <!-- Spam trap: hidden from people, tempting to bots. Leave it empty. -->
  <input
    type="text"
    name="_mtf_honeypot"
    tabindex="-1"
    autocomplete="off"
    aria-hidden="true"
    style="position:absolute;left:-9999px"
  >

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

Replace your existing <form> tag, or just change its action attribute. The browser lands on a hosted success page, or on your own page if you add a hidden _mtf_redirect field that points at one of the form’s allowed domains.

Two optional hidden fields. _mtf_redirect sends the visitor back to your site after a successful submit, and must be an absolute URL on one of the form’s allowed domains. _mtf_subject sets the notification’s subject line, and {{name}} inserts the value of the field called name. Neither one appears in the email or the inbox.

Your own thank-you page and subject line
<form action="https://mtform.co/f/your-form-key" method="POST">
  <input type="hidden" name="_mtf_redirect" value="https://example.com/thanks">
  <input type="hidden" name="_mtf_subject" value="Website enquiry from {{name}}">

  <label for="name">Name</label>
  <input id="name" name="name" autocomplete="name" required>

  <label for="email">Email</label>
  <input id="email" name="email" type="email" autocomplete="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" required></textarea>

  <div aria-hidden="true" style="position:absolute;left:-9999px;">
    <input name="_mtf_honeypot" type="text" tabindex="-1" autocomplete="off">
  </div>

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

Step by step

  1. 1

    Create a form endpoint

    Sign up and create a form. You get a public endpoint URL (safe to put in client code) and a searchable inbox: no server to deploy.

  2. 2

    Point your form’s action at it

    Change your <form> tag’s action attribute to the endpoint and set method="POST". Keep your existing fields and markup.

  3. 3

    Verify your email once

    Click the verification link so notifications can be delivered. Submissions received before verification are still stored, never dropped.

  4. 4

    Submit and confirm

    Fill in the form. The submission arrives in your inbox and by email, with the sender in Reply-To so you can respond directly.

Why mailto: doesn’t work

The one-liner everyone tries first. It doesn’t send anything. It opens the visitor’s email client with a blank draft, loses the data if they don’t have one configured, and exposes your address to scrapers.

The mailto trick · don’t ship this
<!-- Looks like it emails you. It does not. -->
<form action="mailto:you@example.com" method="POST" enctype="text/plain">
  <input name="email" type="email">
  <textarea name="message"></textarea>
  <button>Send</button>
</form>

Common pitfalls

Using mailto: in production

mailto: depends on the visitor having a configured desktop mail client, sends nothing on most phones, and publishes your address for spam harvesters. It’s a demo, not a contact form.

Spoofing the sender in From

Never set the notification’s From to the submitter’s address. It fails SPF/DKIM and lands in spam. Put the submitter in Reply-To (a good endpoint does this for you) and send from an authenticated address.

Putting SMTP credentials in the page

Browser libraries that “send email over SMTP” from JavaScript only work by shipping your mail login, or a token that can send as you, to every visitor. Anyone can open the page source, copy it, and send spam from your account.

Fix: Keep mail credentials on a server. A form endpoint holds them for you, so the page only ever contains a URL that can accept submissions.

Inputs without a name attribute

The browser only sends fields that have a name. An id or a placeholder is not enough, so a field without a name arrives empty or not at all.

Fix: Give every input, select and textarea a name, such as name="email".

Troubleshooting

SymptomWhat’s happeningFix
mailto: opens a draftYou used action="mailto:", the browser hands off to a mail client instead of sending.Switch the action to a real endpoint URL that receives the POST server-side.
no email arrivesThe recipient address hasn’t been verified, or the notification went to spam.Verify the recipient once; check the inbox (submissions are stored regardless) and your spam folder.
goes to spamThe message is failing authentication or the From is spoofed.Use an endpoint that sends from its own authenticated domain and maps the submitter to Reply-To.
stays on the endpoint pageAfter submitting, the visitor sees a confirmation page on the endpoint host instead of your site.Add a hidden _mtf_redirect field with an absolute URL, and add that site to the form’s allowed domains.

Frequently asked questions

Why can’t an HTML form send email directly?

HTML only describes the form and where to POST it. Sending email requires a server that receives the submission and talks to a mail service (SMTP/API). Browsers deliberately can’t send mail, so you need either your own server or a hosted form endpoint that does it for you.

Is there an HTML tag to send an email from a form?

No. There is no HTML element that sends email. The closest, action="mailto:", just opens the visitor’s email app with a draft. It doesn’t deliver anything and often does nothing on mobile.

Can I send an HTML form to email without any backend code?

Yes. Point the form’s action at a hosted form endpoint. It receives the POST, filters spam, stores the submission, and emails it to you, so you write no server code and host nothing extra.

How do I make an HTML contact form send to my email?

Set the form’s action to a form endpoint URL and its method to POST, give every input a name, and verify your address once. Each submission is then emailed to you with the visitor’s address in Reply-To, so you can answer with a normal reply.

Can I send form data to email without PHP?

Yes. PHP’s mail() only works on a host that runs PHP, and its messages often land in spam. A hosted form endpoint does the receiving and the sending for you, so a plain HTML page on any host can submit to email with no PHP at all.

Does this work on a static site like GitHub Pages or Netlify?

Yes. Because the endpoint is external, static hosts that can’t run server code work fine: the form just POSTs to the endpoint’s URL.

Can an HTML form send email through SMTP?

Not by itself. Browsers can’t open an SMTP connection, and SMTP needs a username and password that must never be in a web page. Something on a server has to receive the form and talk to the mail server. A form endpoint is that server, so you don’t run or secure one yourself.

Can I change the subject line of the email?

Yes. Add a hidden input named _mtf_subject with the subject you want. Placeholders like {{name}} insert a submitted value, so each email can say who it is from. You can also set a default subject in the form’s settings.

How do I send the visitor back to my own thank-you page?

Add a hidden input named _mtf_redirect whose value is the full URL of your thank-you page, and list that site in the form’s allowed domains. After a successful submit the browser goes there instead of the endpoint’s confirmation page.

Keep going

Ship this form for real.

Create an endpoint, paste it in and watch the first submission land in your inbox.

Create free endpoint