Skip to content

mentallyinspired/take-my-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Take My Form

Take My Form is a easy to implement endpoint for your HTML forms. Perfect for your static/jamstack sites.

It uses FastAPI, smtplib and EmailMessage to take care of everything.

Implementation on the frontend is as simple as:

<form action="https://yourdomain.com/api/submit/your@email.com" method="POST">
     <input type="text" name="name" required>
     <input type="text" name="subject" required>
     <input type="email" name="email" required>
     <input type="textfield" name="message" required>
     <textarea name="message" rows="4" cols="50">
     <button type="submit">Submit</button>
</form> 

How it works

On submission

  1. Check if the domain is in the allowed origin list
  2. Submit if origin (website) domain is in the list

It's as simple as that.

How to run it

Take My Form is currently in beta (it works as intended).

  1. Clone this git repo
  2. Build container
  3. Create config
  4. Adjust the config
  5. Restart container

Clone the repo

git clone https://github.com/mentallyinspired/take-my-form.git
cd take-my-form

Build docker container

sudo docker build -t take-my-form .

Create the config

docker

sudo docker compose up -d && sudo docker compose down

Config

Edit the config in the mapped docker volume

Run it

$ docker-compose up -d

Form action

Point your form action to ../api/submit/your@email.com like:

<form action="https://yourdomain.com/api/submit/your@email.com" method="POST">

TODO

  • Build working docker container
  • Docker-compose file with reverse proxy
  • Implement static CORS
  • Implement validation process for sending emails
    • This will allow the server make use of emails with different domain to the website the form is in
  • Probably more

Releases

No releases published

Packages

No packages published