# logship-mail-archive

Small read-only HTTP API in front of the mailpiler archive, used by the ERP lead page
("E-Mails MP"). Runs on the piler host `192.168.9.53` in `/opt/logship-mail-archive`
(systemd unit `logship-mail-archive`, port 8097, user `piler`). Piler itself is not modified.

- Deploy / update: `sh reference/mail-archive-api/install.sh` (keeps the existing `.env`).
- Config on the host: `/opt/logship-mail-archive/.env` → `PORT`, `PILER_UID`, `MAIL_ARCHIVE_TOKEN`.
- ERP side: `MAIL_ARCHIVE_URL` + `MAIL_ARCHIVE_TOKEN` in `.env` / `.env-prod`.
- Scope: only mails that involve an address of piler account `PILER_UID` (5 = "logou").
- Logs: `journalctl -u logship-mail-archive`. Remove: `systemctl disable --now logship-mail-archive`,
  delete the unit file and the directory.

Endpoints and design notes are in the header of `server.mjs`.
