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.
| Approach | Static hosts | Delivers reliably | Spam protection | Upkeep |
|---|---|---|---|---|
mailto: link | Yes | No, opens the visitor’s mail app | None | Exposes your address |
PHP mail() script | No, needs PHP | Can land in spam | You build it | Server and patches |
| Google Apps Script | Yes | Daily quota limits | You build it | Script and quotas |
| Form endpoint | Yes | Yes, authenticated sending | Built in | None |
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.
<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.
<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
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
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
Verify your email once
Click the verification link so notifications can be delivered. Submissions received before verification are still stored, never dropped.
- 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.
<!-- 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
| Symptom | What’s happening | Fix |
|---|---|---|
| mailto: opens a draft | You 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 arrives | The 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 spam | The 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 page | After 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
Last reviewed by the MakeTheForm team.