Add a form
Point any form on your site at /api/forms/<name>:
html
<form action="/api/forms/contact" method="POST">
<input name="name" required>
<input name="email" type="email">
<textarea name="message"></textarea>
<input type="hidden" name="_next" value="/thanks.html">
<input name="_honey" style="display:none" tabindex="-1" autocomplete="off">
<button>Send</button>
</form>The form's name (contact here) can be any lowercase word. It appears in the email and on the site's Forms tab.
Choose who gets the emails
On the site's Forms tab, add up to 5 addresses. Each submission is emailed from <site name> <forms@xksites.ca>, with the visitor's email as the reply-to, so you can answer straight from your inbox.
Submissions are also kept on the Forms tab for 90 days.
Special fields
| Field | What it does |
|---|---|
_subject |
The email's subject |
_next |
A page on the same site to show after sending |
_replyto |
The address to reply to, if your field isn't called email |
_honey |
A hidden field that catches bots: if it's filled in, nothing is sent |
These are the same fields FormSubmit uses, so moving a FormSubmit form means changing only its action.
Sending with JavaScript
Post with Accept: application/json to get {"success":"true"} back instead of a redirect:
js
const res = await fetch("/api/forms/contact", {
method: "POST",
headers: { accept: "application/json" },
body: new FormData(form),
});