Docs:Connect a form

Getting started

Connect a form

Connect an HTML form to Mailiy in a few minutes: endpoint, access key, examples for HTML and JavaScript.

Dashboard section: Forms › your form › Setup
In the dashboard under Forms › your form › Setup

Mailiy accepts form data via POST and emails it to your confirmed addresses. It accepts application/x-www-form-urlencoded, multipart/form-data and JSON (max. 128 KB, 50 fields).

Endpoint: https://mailiy.com/api/submit

Instead of the access_key field you can also put the key in the URL: https://mailiy.com/api/submit/YOUR-KEY

Ready-made forms are in the templates, steps for WordPress, Webflow and Framer in the guides.

HTML

<form action="https://mailiy.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR-KEY">
  <input type="hidden" name="subject" value="New contact request">
  <input type="text" name="name" required>
  <input type="email" name="email" required>
  <textarea name="message" required></textarea>
  <label><input type="checkbox" name="consent" value="yes" required> I agree to the processing.</label>
  <input type="checkbox" name="botcheck" class="hidden" style="display:none">
  <button type="submit">Send</button>
</form>

Without JavaScript, Mailiy redirects to the thank-you page after submitting (HTTP 303), or to your own URL. Errors land on the same page with ?error=code.

JavaScript

const res = await fetch("https://mailiy.com/api/submit", {
  method: "POST",
  headers: { "Content-Type": "application/json", Accept: "application/json" },
  body: JSON.stringify({ access_key: "YOUR-KEY", email, message }),
});
const { success, message } = await res.json();

If you send JSON or the Accept: application/json header, Mailiy answers with JSON instead of a redirect.

Without writing code, use our script. It sends every form whose action points to Mailiy in the background and writes the answer below the form:

<script src="https://mailiy.com/client/script.js" defer></script>

Custom text, events and redirects are explained in the guides.