Add a contact form to a Vue / Vite site without a backend

A Vue component's template is HTML. Put a normal HTML form in it, point the form's action at a Lamofel endpoint, and the browser posts the form straight to Lamofel -- the example below has no server code of your own and no API key in it.

  1. Generate the form. Use the free contact form generator at lamofel.com/tools: pick the fields, and it gives you ready-to-paste HTML. No account is needed to generate a form.
  2. Put the HTML in a component. Vue's documentation says all Vue templates are syntactically valid HTML, so the generator's output goes into a single-file component's template block as it is -- no attributes to rename. Save it as, for example, src/components/ContactForm.vue. Example (the generator's output for name, email and message fields; the form action ends in the placeholder CLAIM_YOUR_ENDPOINT until you claim an endpoint):
<template>
  <form action="https://lamofel.com/f/CLAIM_YOUR_ENDPOINT" method="POST">
    <label for="field-name">Name</label>
    <input id="field-name" type="text" name="name" required>
    <label for="field-email">Email</label>
    <input id="field-email" type="email" name="email" required>
    <label for="field-message">Message</label>
    <textarea id="field-message" name="message" rows="5" required></textarea>
    <input type="text" name="_gotcha" tabindex="-1" autocomplete="off" hidden>
    <button type="submit">Send message</button>
  </form>
</template>

Generate a free form

No card needed. 100 messages a month free.

Keep the hidden _gotcha field: it is the spam trap. A filled-in _gotcha field marks the post as spam.

Do not add a submit handler with the .prevent modifier (for example @submit.prevent) to this form: Vue's documentation says .prevent calls event.preventDefault() on the event, which would stop the browser from posting the form to Lamofel. The form needs no script block at all.

  1. Claim your endpoint. On the generator's result page, enter the email address where submissions should arrive and press "Send messages to my email". Your account, the form and the live endpoint are created right away; the claim result gives you the form HTML with your real endpoint in the form action -- put that address in place of the placeholder. Delivery starts after you confirm that address from the email Lamofel sends you; the confirmation link works for 7 days. Then set an allowed domain: posts whose browser Origin or Referer names another site are refused. It is a filter, not proof of the sender -- a script can send any header.
  2. Import the component and use it in a page. Vue's documentation says a compiled single-file component is a standard JavaScript module, so you import it like one. For example, in src/App.vue:
<script setup>
import ContactForm from './components/ContactForm.vue'
</script>

<template>
  <ContactForm />
</template>

Then build and deploy your site the way you normally do. (Starting a new project? Vue's quick start scaffolds a Vite-based single-page app with npm create vue@latest; npm run build writes a production build to the project's ./dist directory, ready to deploy to your host.)

  1. Send a test submission from the live page and check that it arrives in your confirmed inbox.

Limits

Generate a free form ยท See plans · Claim a free endpoint