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.

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)

  1. Open your commandline and navigate inside the project folder.
  2. Run  pipend install or  pip install -r requirements.txt  to install neccessary dependencies (in case it's not working try  python -m pip install -r requirements.txt) .
  3. To start the development server run  pipenv run python runserver.py  or   python runserver.py  to boot the server.
  4. You should see the following message  Running on http://[::]:5000/ (Press CTRL+C to quit) .
  5. 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

  1. Open your commandline and navigate inside the project folder.
  2. Check if the provided  docker-compose.yml  file serves your needs. (E.g. the run command)
  3. Use  docker-compose up  or  docker-compose -f docker-compose.prod.yml up  to start the container.
  4. You should see the following message  Running on http://[::]:5000/ (Press CTRL+C to quit) .
Alternatively you can also pull our image directly from the docker hub using docker pull taliox/mailstatic .