This tool is a small backend meant to provide different useful features for static websites. e.g.: form endpoint, newsletter registration endpoint, etc.
Use this assistant to forward forms on a static website to an email address. The configurable spam blacklist keeps your inbox clean.
Work in progress. Should be released soon.
The setup process is in two steps:
- Deploy this to your favourite server. (see Deploy)
- Point your form to
yourserveraddress/contact
And voilà
Two different options:
- Deploy to a VPS
- Deploy to a PaaS
Follow the process described under Contribution on a VPS, then configure NGINX See Digital Ocean's doc
A Digital Ocean config fill will be added to the project soon.
The assistant is highly configurable. The goal is to be able to deploy one instance and use it for multiple sites.
All the configuration lies in a JSON config file at config/config.json
Here's an example:
{
"allowed_sources": ["testserver", "localhost"], // requests not coming from one of these hosts will be rejected
"email": {
"allow_default_to": true, // if true, requests fron an host not configured in "to" will be forwarded to the default email. If false, they will be rejected
"from": "[email protected]", // sender email address. Must be the one configured in your Postman account
"to": {
"default": "[email protected]", // default forward to email
"myapp": "[email protected]" // "host" : "fowrward to email". This is useful to use one deployment of this tool for multiple static websites with different form recipients
}
},
"spam": {
"emails": ["[email protected]"], // emails spamlist. Requests with one of these as reply_to address will be rejected
"content": ["please check this obscure website"] // requests with these sequences in the body will be rejected
}
}
Contributions are welcome in the form of PR's. Please open an issue first, so we can discuss the change beforehand.
Here's how to setup your local environment:
- Python 3.9
- A Postmark account and API token.
- Clone this repos
git clone [email protected]:svandegar/static-assistant.git && cd static-assistant
- Create a virtual environment at the project root
virtualenv venv
- Activate the virtual environment
source venv/bin/activate
- Install the Python dependencies
pip install -r requirements
- Duplicate
config/.env.example
and rename it to.env
cp config/.env.example config/.env
- Add your Postmark token in .env
- Add your own config to
config/contig.json
(see Config section) - Run the tests
pytest