docker-mailserver-api or dms-api is a sidecar container for https://github.com/docker-mailserver/docker-mailserver that allows managing objects using a simple rest api.
- clone this repository into a sub-folder (e.g. dms-api) next to your original compose.yaml file
- set your own dms-api.dev based on the provided dms-api.example.env
- add the following service configuration to your docker.yaml:
dms-api:
build: ./dms-api/image
restart: always
working_dir: /app
environment:
- NODE_ENV=production
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./dms-api/:/app
ports:
- "3000:3000"
command: sh -c "npm install && npm start"
- rerun the deployment
- list emails: http::server:3000/email/list
- add new email account: http::server:3000/email/add?email=james&password=topsecret
- update email's password: http::server:3000/email/update?email=james&password=topsecret
- delete email: http::server:3000/email/del?email=james
Note: for now, only email list/add/update/del commands are supported, but PRs for more actions are welcome :)
Tip
you can set the default email domain in the DEFAULT_MAIL_DOMAIN variable, so that you can pass to the API only the account name - for example james instead james@bond.com