Skip to content

Email microservice for EnviDat, based on jdrouet/catapulte.

License

Notifications You must be signed in to change notification settings

EnviDat/email-microservice

Repository files navigation

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": "envidat@wsl.ch",
  "params": {"user_email": "YOUR_USER@wsl.ch", "user_token": "jhsdgfiusdhfiudshf", "user_name": "Test", "site_url": "https://envidat.ch"},
  "to": "YOUR_USER@wsl.ch"
}'
import requests

email_to = "YOUR_USER@wsl.ch"
headers = {"Content-Type": "application/json"}
params = {
    "from": "envidat@wsl.ch",
    "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)

About

Email microservice for EnviDat, based on jdrouet/catapulte.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published