Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.26 KB

README.md

File metadata and controls

59 lines (46 loc) · 1.26 KB

Email Microservice

Email microservice for EnviDat, based on jdrouet/catapulte: https://github.com/jdrouet/catapulte

Running

  1. Create runtime.env with environment variables:
# LOG: debug
SMTP__HOSTNAME: YOUR_MAIL_SERVER
SMTP__PORT: YOUR_MAIL_PORT
  1. Add you MJML templates to the templates directory.

  2. Run the server

docker compose -f docker-compose.main.yml up -d

  1. 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)