scribase-mail-studio/.env.example
caelum0x e91eb482bb feat(send): verify recipient addresses with reacherhq before every send
Wires reacherhq/check-if-email-exists (self-hosted, MIT licensed) as a
pre-send validator in the queue worker, right before the provider dispatch
that every send path (API, SMTP proxy, campaigns, scheduled, double opt-in)
shares. Recipients confirmed undeliverable are dropped before a send credit
is spent instead of bouncing after the fact.

Fails open by design: disabled, unconfigured, slow, or unreachable verifier
means every recipient is treated as unverified and the send proceeds
unchanged. A down validator must never silently drop a legitimate send.

- apps/web/src/server/service/address-verification-service.ts: REST client
  for the reacherhq/backend HTTP API (POST /v0/check_email), batched,
  timeout-bounded, never throws.
- apps/web/src/server/service/email-queue-service.ts: call the verifier
  right before provider.sendRawEmail; reject with status REJECTED when
  every recipient is invalid, otherwise send to the deliverable subset only.
- apps/web/src/env.js: REACHER_ENABLED / REACHER_API_URL / REACHER_API_KEY /
  REACHER_TIMEOUT_MS / REACHER_BLOCK_VERDICTS.
- compose.yml: optional `reacher` sidecar behind a profile (needs outbound
  port 25, so it's opt-in, not part of the default self-host stack).
- docs/SELF-HOSTING.md, .env.example, .env.selfhost.example: how to turn it
  on.

25 new/updated unit tests (12 for the service in isolation covering block,
allow, fail-open on error/timeout/non-2xx, disabled, unconfigured, batching,
custom block list; 13 in the queue worker covering full-block, partial-block,
and the default pass-through path). Full web unit suite: 574/574 passing.
2026-10-16 17:50:06 +03:00

41 lines
1.3 KiB
Plaintext

DATABASE_URL="postgresql://usesend:password@localhost:54320/usesend"
REDIS_URL="redis://localhost:6379"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET=""
# Oracle Cloud Email Delivery - SMTP relay used for sending
SMTP_HOST="smtp.email.eu-frankfurt-1.oci.oraclecloud.com"
SMTP_PORT="587"
SMTP_USER=""
SMTP_PASS=""
# Oracle Cloud Email Delivery - API (domains, DKIM, approved senders, suppressions)
OCI_REGION="eu-frankfurt-1"
OCI_TENANCY=""
OCI_USER=""
OCI_FINGERPRINT=""
# Either the PEM contents (\n escapes allowed) or a path to the key file
OCI_PRIVATE_KEY=""
# OCI_PRIVATE_KEY_PATH="/path/to/oci_api_key.pem"
# OCI_COMPARTMENT_ID="" # defaults to the tenancy
# System emails (sign-in codes, invites) are sent from this address via the relay
FROM_EMAIL="Scribase Mail <noreply@mail.example.com>"
API_RATE_LIMIT=10
AUTH_EMAIL_RATE_LIMIT=5
# Optional: prefix all Redis keys (useful for shared Redis with ACL isolation)
# REDIS_KEY_PREFIX=""
# Pre-send address verification (reacherhq/check-if-email-exists). Point at a
# self-hosted "reacherhq/backend" Docker container; leave REACHER_API_URL
# unset to disable (every send is treated as unverified, never blocked).
# REACHER_API_URL="http://localhost:8080"
# REACHER_API_KEY=""
# REACHER_TIMEOUT_MS=4000
# REACHER_BLOCK_VERDICTS="invalid"
NEXT_PUBLIC_IS_CLOUD=false