mailstatic
A small python based open source server which allows you to send mails from a static webpage via a simple HTML form. Find the open source project on GitHub.
Advantages
mailstatic really comes in handy if you want to provide a static HTML page with no actual backend. It's an easy-to-use tool to process user inputs by simply adding HTML forms.- Open Source (MIT licensed)
- spam protection
- no JS or PHP needed
- allows data processing
- small code base
- quick to set up
Setup
HTML Setup
To setup a HTML form on your webpage simply copy the following code:<form action="yourdomain/s/your@mail.com" method="POST">
<input name="name" required="" type="text">
<input name="replyto" required="" type="email">
<textarea name="message"></textarea>
<input value="Send" type="submit">
</form>
All input of this form is now forwarded to your server.
Python Setup (development and production)
- Open your commandline and navigate inside the project folder.
-
Run
pipend install
orpip install -r requirements.txt
to install neccessary dependencies (in case it's not working trypython -m pip install -r requirements.txt)
. -
To start the development server run
pipenv run python runserver.py
orpython runserver.py
to boot the server. -
You should see the following message
Running on http://[::]:5000/ (Press CTRL+C to quit)
. -
If you want to start the production server, start it with gunicorn:
pipenv run pipenv run gunicorn mailstatic:app --bind 127.0.0.1:5000
. It may be a good idea to use a reverse-proxy like nginx in front of it to terminate SSL and buffer slow requests. See the GitHub repository for example configurations.
Docker Setup
- Open your commandline and navigate inside the project folder.
-
Check if the provided
docker-compose.yml
file serves your needs. (E.g. the run command) -
Use
docker-compose up
ordocker-compose -f docker-compose.prod.yml up
to start the container. -
You should see the following message
Running on http://[::]:5000/ (Press CTRL+C to quit)
.
docker pull taliox/mailstatic
.