Email microservice for EnviDat, based on jdrouet/catapulte: https://github.com/jdrouet/catapulte
- Create runtime.env with environment variables:
# LOG: debug
SMTP__HOSTNAME: YOUR_MAIL_SERVER
SMTP__PORT: YOUR_MAIL_PORT
-
Add you MJML templates to the
templates
directory. -
Run the server
docker compose -f docker-compose.main.yml up -d
- Use via a POST request:
curl -X 'POST' \
'http://envidatdocker.wsl.ch:3010/templates/access-token/json' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"from": "[email protected]",
"params": {"user_email": "[email protected]", "user_token": "jhsdgfiusdhfiudshf", "user_name": "Test", "site_url": "https://envidat.ch"},
"to": "[email protected]"
}'
import requests
email_to = "[email protected]"
headers = {"Content-Type": "application/json"}
params = {
"from": "[email protected]",
"to": email_to,
"params": {
"user_email": email_to,
"user_token": "jhsdgfiusdhfiudshf",
"user_name": "Test",
"site_url": "https://envidat.ch",
}
}
r = requests.post(
"http://envidatdocker.wsl.ch:3010/templates/access-token/json",
headers=headers,
json=params,
)
print(r.status_code)