DEV Community

Cover image for How to send contact form emails with a simple token-based endpoint
Ricardo Augusto
Ricardo Augusto

Posted on

How to send contact form emails with a simple token-based endpoint

Most small websites eventually need the same thing: a contact form that sends an email.

That sounds simple, but the implementation often becomes more work than expected:

  • SMTP credentials
  • mail libraries
  • server-side validation
  • anti-abuse handling
  • formatting the submitted fields
  • deployment differences between hosts

I built FlapMail as a lightweight way to handle this pattern with a token-based submit endpoint.

It is meant for transactional messages such as:

  • contact forms
  • quote requests
  • help desk forms
  • HR forms
  • app alerts
  • script notifications

It is not a bulk email or newsletter tool.

Basic flow

  1. Create an account at https://www.flapmail.net/
  2. Create a sender
  3. Generate a token
  4. Send form data to:

LINK TO API
https://app.flapmail.net/api/submit.php


## Example payload

Enter fullscreen mode Exit fullscreen mode


js
const formData = new FormData();
formData.append("token", "YOUR_FLAPMAIL_TOKEN");
formData.append("name", "Jane Doe");
formData.append("email", "jane@example.com");
formData.append("message", "Hello from my website");

await fetch("https://app.flapmail.net/api/submit.php", {
method: "POST",
body: formData
});




## Docs and examples

I published examples for HTML, PHP, Node.js, Java, and Python here:

https://github.com/SpaceHubCompany/FlapMail

I would appreciate feedback from developers who maintain small websites, landing pages, dashboards, or AI-generated projects.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)