PostMe

Docs

Customize what happens after someone submits your form — redirect, show a message, or handle the result in JavaScript.

Two ways to submit

Classic HTML

<form method="POST"> — browser navigates to PostMe or your _next URL. No CORS setup.

JavaScript (fetch)

Stay on your page. PostMe returns JSON with CORS headers. Read redirect and message in your script. Send new FormData(form) (recommended) or application/json with a flat object of string fields.

Response fields

Add hidden inputs (names start with _). They are not included in the email.

FieldPurpose
_nextHTTPS URL to send the visitor after a successful submit (HTML redirect or JSON redirect).
_postme_messageCustom success message (thank-you page or JSON message).
_postme_pending_messageMessage when the inbox still needs email confirmation.
_postme_error_nextHTTPS URL to send the visitor when the submit fails (limit, rate limit, etc.).
_postme_jsonForce a JSON response (optional; fetch from another site does this automatically).
_postme_hpHoneypot — leave hidden and empty. Filled = silently ignored (anti-spam).

Example with options

<form action="https://www.postme.dev/submit/you@example.com" method="POST">
  <input type="text" name="name" required />
  <textarea name="message" required></textarea>

  <input type="hidden" name="_subject" value="New inquiry" />
  <input type="hidden" name="_next" value="https://www.postme.dev/thanks" />
  <input type="hidden" name="_postme_error_next" value="https://www.postme.dev/error" />
  <input type="hidden" name="_postme_message" value="Thanks! We'll reply soon." />
  <input type="hidden" name="_postme_pending_message" value="Confirm your email to activate this form." />

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

JavaScript example

form.addEventListener("submit", async (e) => {
  e.preventDefault();
  const res = await fetch("https://www.postme.dev/submit/you@example.com", {
    method: "POST",
    body: new FormData(form),
  });
  const data = await res.json();

  if (!data.ok) {
    if (data.errorRedirect) location.href = data.errorRedirect;
    else alert(data.message);
    return;
  }

  if (data.status === "pending_confirmation") {
    showBanner(data.message);
    return;
  }

  if (data.redirect) location.href = data.redirect;
  else showBanner(data.message);
});

JSON response shape

// Success (inbox verified)
{ "ok": true, "status": "sent", "message": "…", "redirect": "https://…" | null }

// First submit — confirm inbox
{ "ok": true, "status": "pending_confirmation", "message": "…", "redirect": null }

// Error
{ "ok": false, "status": "error", "code": "monthly_limit", "message": "…",
  "redirect": null, "errorRedirect": "https://…" | null }

Email delivery fields

  • _subject — notification subject line
  • _replyto — visitor email for Reply-To
  • _cc — CC on the notification

← Back home · Live demo