Последняя версияLatest: 0.6.09.031531
Стабильная версияStable: 0.6.09.031531
Установка
Install
Последняя:
Latest:
curl -fsSL https://packages.novij.tech/services/mail/install.sh | sudo bash -s -- install konan-mail.novij.tech
Стабильная:
Stable:
curl -fsSL https://packages.novij.tech/services/mail/install.sh | sudo env NOVIJ_PACKAGE_CHANNEL=stable bash -s -- install konan-mail.novij.tech
Релизы
Releases
stable
- Релизов пока нет.
- No releases yet.
Команды
Commands
novij-mail-service api- Запускает HTTP API сервиса.Runs the service HTTP API.
novij-mail-service worker- Запускает worker для IMAP sync, dispatch и SMTP send queue.Runs the worker for IMAP sync, dispatch, and SMTP send queue.
novij-mail-service migrate- Применяет SQL-миграции PostgreSQL.Applies PostgreSQL SQL migrations.
novij-mail-service version- Показывает service_id, package version и build commit.Shows service_id, package version, and build commit.
novij-mailctl registry status --once- Показывает Service Registry state, agent_id и wallet infra.Shows Service Registry state, agent_id, and wallet infrastructure.
novij-mailctl registry register --once- Регистрирует сервис и agent в Relay Service Registry.Registers the service and agent in the Relay Service Registry.
novij-mailctl mailbox backfill MAILBOX_ID --from 2026-01-01 --to 2026-07-05 --filter-json '{"has_attachments":true}' --dry-run- Проверяет письма за период по generic фильтрам без изменения UID cursor.Checks messages for a period with generic filters without moving the UID cursor.
systemctl status novij-mail-service.service- Проверяет API systemd unit.Checks the API systemd unit.
systemctl status novij-mail-worker.service- Проверяет worker systemd unit.Checks the worker systemd unit.
systemctl status novij-mail-registry.timer- Проверяет повторную регистрацию Service Registry.Checks Service Registry retry registration.
curl -fsS https://konan-mail.novij.tech/api/v1/health- Проверяет публичный health endpoint.Checks the public health endpoint.
Частые сценарии
Common Scenarios
1. Что закрывает сервис1. What the service covers
Novij Mail Service ставится как отдельный backend с API и worker. Он подключает проектные IMAP/SMTP ящики, забирает новые письма, сохраняет metadata и вложения, а затем отправляет события в Actions или webhook проекта.
Novij Mail Service runs as a standalone backend with API and worker processes. It connects project IMAP/SMTP mailboxes, fetches new messages, stores metadata and attachments, and dispatches events to Actions or a project webhook.
incoming | IMAP sync по папкам, dedupe по UID/message/body hash и событие mail.message.received.IMAP folder sync, UID/message/body hash dedupe, and mail.message.received events. |
|---|---|
attachments | Сохраняются filename, MIME, size, SHA256, download reference и TTL; для каждого вложения создаётся событие mail.message.attachment.created.Stores filename, MIME, size, SHA256, download reference, and TTL; each attachment produces a mail.message.attachment.created event. |
backfill | Сканирование IMAP за период без отметки писем прочитанными и без сдвига обычного UID cursor.IMAP period scan without marking messages read and without moving the normal UID cursor. |
dispatch | Поддерживаются Actions target и custom webhook; payload подписывается service-agent ключом.Supports Actions targets and custom webhooks; payloads are signed with the service-agent key. |
send | Минимальная SMTP queue для template/send API со статусами queued, sent, failed.Minimal SMTP queue for the template/send API with queued, sent, and failed statuses. |
security | Пароли ящиков хранятся через service vault; state-changing API принимает timestamp/signature/idempotency.Mailbox passwords are stored through the service vault; state-changing API accepts timestamp/signature/idempotency. |
registry | well-known endpoints и service-health совместимы с Service Registry.well-known endpoints and service-health are compatible with Service Registry. |
2. Установка на домен2. Install for a domain
Инсталлятор проверяет Ubuntu 24.04, DNS, nginx, PostgreSQL, systemd units, TLS и локальный smoke. Для production секреты передаются через env/CI variables, не через git.
The installer validates Ubuntu 24.04, DNS, nginx, PostgreSQL, systemd units, TLS, and a local smoke check. Production secrets are provided through env/CI variables, not through git.
curl -fsSL https://packages.novij.tech/services/mail/install.sh | sudo bash -s -- install konan-mail.novij.tech
curl -fsS https://konan-mail.novij.tech/api/v1/health
curl -fsS https://konan-mail.novij.tech/.well-known/novij/status.json
novij-mailctl registry status --once
3. Подключить Actions target3. Connect an Actions target
Для стандартного flow укажите project_id и Actions service id. После этого входящие письма будут уходить в Actions как service events.
For the standard flow, provide project_id and the Actions service id. Inbound messages will then be dispatched to Actions as service events.
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/event-targets \
-H 'content-type: application/json' \
-d '{
"project_id": "project_demo",
"type": "actions_service",
"actions_service_id": "novij.actions"
}'
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/event-targets/TARGET_ID/test
4. Подключить почтовый ящик4. Connect a mailbox
Mailbox API хранит IMAP/SMTP настройки и зашифрованный пароль. В примере пароль показан как placeholder; реальные значения передавайте только через защищённый runtime.
The mailbox API stores IMAP/SMTP settings and an encrypted password. The example uses a placeholder password; pass real values only through a protected runtime.
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/mailboxes \
-H 'content-type: application/json' \
-d '{
"project_id": "project_demo",
"owner_wallet_id": "wallet_demo",
"display_name": "Invoices inbox",
"email": "inbox@example.com",
"provider": "custom",
"incoming": {"protocol": "imap", "host": "imap.example.com", "port": 993, "tls": "required"},
"outgoing": {"protocol": "smtp", "host": "smtp.example.com", "port": 587, "tls": "starttls"},
"auth": {"type": "password", "username": "inbox@example.com", "password": "APP_PASSWORD"},
"folders": ["INBOX"],
"idempotency_key": "mailbox-project-demo-invoices"
}'
5. Проверить IMAP sync и вложения5. Check IMAP sync and attachments
После подключения можно проверить credentials, принудительно синхронизировать папку и скачать сохранённое вложение по attachment id.
After connecting a mailbox, validate credentials, force a folder sync, and download a stored attachment by attachment id.
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/mailboxes/MAILBOX_ID/test
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/mailboxes/MAILBOX_ID/sync-now
curl -fsS https://konan-mail.novij.tech/api/v1/attachments/ATTACHMENT_ID/download -o attachment.bin
6. Backfill по фильтрам6. Filter-based backfill
Backfill сканирует IMAP за период, применяет generic фильтры письма и вложений, а затем в обычном режиме создаёт те же события, что и live sync.
Backfill scans IMAP for a period, applies generic message and attachment filters, and in normal mode creates the same events as live sync.
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/mailboxes/MAILBOX_ID/backfill \
-H 'content-type: application/json' \
-d '{
"from_date": "2026-01-01",
"to_date": "2026-07-05",
"filters": {
"from": ["billing@example.com"],
"subject_contains": ["счет"],
"has_attachments": true,
"attachment_name_regex": "\\.pdf$",
"attachment_mime": ["application/pdf"]
},
"dispatch": {"target": "actions", "mode": "normal_events"},
"dry_run": true
}'
novij-mailctl mailbox backfill MAILBOX_ID \
--from 2026-01-01 \
--to 2026-07-05 \
--filter-json '{"subject_contains":["счет"],"has_attachments":true,"attachment_name_regex":"\\.pdf$"}' \
--dispatch-target actions \
--dry-run
7. Поставить исходящее письмо в очередь7. Queue an outbound email
Минимальный send API кладёт письмо в очередь worker. Статус отправки читается отдельным GET-запросом.
The minimal send API queues a message for the worker. Send status is read through a separate GET request.
curl -fsS -X POST https://konan-mail.novij.tech/api/v1/send \
-H 'content-type: application/json' \
-d '{
"project_id": "project_demo",
"mailbox_id": "MAILBOX_ID",
"from": {"email": "inbox@example.com"},
"to": [{"email": "recipient@example.com"}],
"subject": "Novij Mail Service test",
"text": "Hello from Novij Mail Service",
"idempotency_key": "send-project-demo-001"
}'
curl -fsS https://konan-mail.novij.tech/api/v1/send/SEND_ID
8. Health, обновление и rollback8. Health, update, and rollback
curl -fsS https://konan-mail.novij.tech/api/v1/version
curl -fsS https://konan-mail.novij.tech/api/v1/settings
curl -fsS https://konan-mail.novij.tech/.well-known/novij/service-health
curl -fsS https://konan-mail.novij.tech/api/v1/service-registry/status
curl -fsSL https://packages.novij.tech/services/mail/install.sh | sudo bash -s -- update
curl -fsSL https://packages.novij.tech/services/mail/install.sh | sudo bash -s -- rollback