A simple email forwarder for static websites.
The application is partially an experiment on writing the smallest application that can serve the function of delivering SES emails from a HTTP POST.
Current approach is to leaverage the zappa toolkit to automate the creation of the AWS services, API Gateway and Lambda.
To manage the HTTP POST workflow flask was chosen as a simple web microframework.
Local development is simple, check out the code and run the flask container.
pip install -r requirements.txt
python ses_forwarder.py
This should launch the flask container listening on port 5000 that you can access to simulate the connection to
curl -H "Content-Type: application/json" -X POST -d '{"subject":"this is the subject","body":"and this is the body"}' http://localhost:5000/contact
Configuration for the lambda is externalised into a JSON file config.json
. This file contains the configurable
options that need to be set for the lambda function to
work for you.
Create a config.json
file in the root folder of this project and customise the following example:
{
"from_address": "[email protected]",
"to_address": "[email protected]"
}
Deployment is managed by Zappa.
Zappa will be installed as part of the pip install -r requirements.txt
command but still requires minimal configuration for your environment.
Create a zappa_settings.json
file that contains the s3 bucket you want to deploy your application to before it is deployed into AWS Lambda.
{
"dev": {
"app_function": "ses_forwarder.send_email",
"s3_bucket": "lambda.ses_forwarder"
}
}
See the Zappa documentation for further details for advanced configuration of the zappa_settings.json
file.