env.js and waitlist-auto-approve-service.ts (526d6a9) already consume
AUTO_APPROVE_FREE_PROVIDERS and AUTO_APPROVE_FREE_PROVIDER_DAILY_CAP, but
the web service's environment allowlist in
deploy/compose.scribase-mail.yml never listed either var, and there is
no env_file fallback in this manifest. Setting them in deploy/.env alone
was a no-op: docker compose would not forward them into the container,
Zod would fall back to its "false" default, and free-provider
auto-approval stayed permanently off regardless of the env file.
Add both vars to the web service's environment block (default false /
10, matching the Zod schema defaults) and document them in
deploy/.env.example next to the existing AUTO_APPROVE_WAITLIST pair.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DEPLOY.md's "Implemented so far" line still described the API as it was at
the initial skeleton commit (POST/GET /emails only) and claimed
attachments[].path/content_type/content_id return a 422 "not yet supported" -
all three have been fully implemented (with SSRF-guarded URL fetching for
path) since the Round 1a merge. Only topic_id is actually unsupported.
This matters for distribution: the product's whole pitch is "switch from
Resend with one line," and the deploy doc customers read to evaluate
migration was understating the real API surface (domains, api-keys,
webhooks, broadcasts, audiences/contacts, segments, contact-properties,
topics, templates, suppressions, logs, metrics, inbound mail - none of which
were mentioned at all) and incorrectly telling them a commonly-used Resend
field (attachment by URL) isn't supported when it is.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
On the hosted instance (IS_CLOUD) a new or waitlisted user is let in
automatically when their verified account email is on a business domain:
not a free/consumer provider, not a disposable inbox (CC0 list from
disposable-email-domains), with a usable MX record (3 s timeout, null MX
and IP/localhost exchanges rejected). One account per domain (DB check +
Redis claim) and a daily cap (AUTO_APPROVE_DAILY_CAP, default 25).
Everything fails closed to the existing waitlist flow.
Opt-in via AUTO_APPROVE_WAITLIST (default off). Approval only clears
User.isWaitlisted, so warm-up caps, reputation auto-pause, content
screening and the review queue still apply to new teams. Decisions are
logged, recorded in the admin team's audit log and mailed to the admin.
The waitlist form re-checks the account email (never the self-declared
domain) and sends approved users straight to the dashboard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With INBOUND_ENABLED the process started the authenticated submission
proxy on 25/587/2587 first, so the inbound MX failed with EADDRINUSE and
port 25 served the relay instead of the MX. The submission proxy now
skips the inbound port, and SUBMISSION_ENABLED=false (set for the mx
compose service) runs the container as a pure MX.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Webhook deliveries are POSTed from inside the deployment network and the
response body is stored in the delivery log, so a customer URL pointing at
169.254.169.254, Redis, Postgres or another container could read internal
services. URLs are now checked on create, update and again at send time
(DNS may change): http(s) only, no credentials, no localhost, and every
resolved address must be public. WEBHOOK_ALLOWED_PRIVATE_HOSTS exempts
named internal hosts for operator smoke tests.
Webhooks created through the Resend API passed userId 0 into
createdByUserId, which violates the User foreign key; store null instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mx service authenticates to /api/internal/inbound* with the shared
secret, but the web container never received it, so every inbound mail
was refused with 503.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every email (API, SMTP proxy, campaigns, scheduled) now passes one send
gate in the queue worker right after the limit check:
- ContentScreeningService: extracts all links (href/src/action, bare URLs,
redirect/tracking-wrapped targets) and checks them against a threat-feed
host index (default: Phishing.Database active phishing domains, MIT),
stored in Redis as a ~3 MB sorted hash index and refreshed every 6h by
a BullMQ job. Shared platforms are exempt from feed matches.
- In-process heuristics: blocked attachment types (.exe/.js/.scr/.iso/...),
raw-IP links, URL shorteners, link-text/href domain mismatch,
javascript:/data: links, base64-only bodies, missing unsubscribe on
marketing mail, phishing/crypto/gift-card language, caps, hidden text.
- Verdicts: allow / hold / reject. Rejections return a clear 400 on the
API/SMTP path and refuse campaigns at schedule time; malicious rejects
are strikes and 3 in 7 days block the team.
- First-sends review: new cloud teams' emails are HELD until 20 sent and
48h old (configurable in sending-policy.ts / env), unless verified or
trusted (Team.sendingTrustedAt).
- New EmailStatus HELD + EmailReview table; customers see HELD in logs
and GET /v1/emails/{id} (latestStatus); admin is emailed (rate-limited).
- Admin > Review (/admin/review, adminReview tRPC router): sandboxed
CSP-locked preview, approve / approve and trust / approve team / reject
(note) / reject and block team.
- Cleanup job keeps bodies of HELD emails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- deploy/scribase-mail.caddy: mail-api.scribase.com site block that rewrites
every path to /api/resend{uri}, so Resend SDKs use the host root as baseUrl
and nothing else of the app is exposed there. Single-level subdomain
because Universal SSL and the *.scribase.com Origin CA cert do not cover
api.mail.scribase.com. Validated with infra-box caddy/test/validate.sh.
- DEPLOY.md: DNS precondition, host table, SDK smoke test (Node and Python
base URL env vars), sending-only key semantics, 10 req/s default.
- API_RATE_LIMIT example/compose default 2 -> 10 to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Plans FREE / PRO ($20, 50k/mo, 10 domains) / SCALE ($90, 100k/mo,
1,000 domains) with $0.90 per 1,000 overage, defined once in
packages/lib/src/constants/pricing.ts and used by PLAN_LIMITS, the
billing UI and the marketing pricing section
- Dodo checkout sessions, customer portal, prorated plan change,
cancel/resume at period end (official dodopayments SDK)
- /api/webhook/dodo verified with Standard Webhooks via SDK unwrap();
idempotent per webhook-id (BillingWebhookEvent claim and billing writes
in one transaction); handles subscription active/renewed/plan_changed/
on_hold/cancelled/failed/expired and payment succeeded/failed; ignores
other products on the shared Dodo business
- Usage job ingests daily sent-email counts as Dodo usage events with
deterministic ids (team + day), 3-day catch-up, 1,000-event batches
- Migration: Plan BASIC -> PRO, add SCALE; Team.stripeCustomerId ->
billingCustomerId; provider-neutral Subscription (provider, customerId,
plan, productId/productIds)
- Remove stripe package, Stripe route and STRIPE_* env; add DODO_* env,
compose/.env.example entries and owner steps in deploy/DEPLOY.md
- Billing UI degrades to "Billing not configured" without keys
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resend parity for delivery outcomes. OCI Email Delivery writes one
OutboundRelayed service-log record per recipient (relay, bounce, complaint);
a new one-minute BullMQ job reads them through the OCI Logging Search API
(no Connector Hub push: Notifications HTTPS caps at 60 msgs/min per topic)
and feeds Delivery / Bounce / Complaint events through processEmailEvent.
- Provider: ensureDeliveryLogs (idempotent, cached) creates the
"scribase-mail" log group and emaildelivery service logs
(outboundrelayed, outboundaccepted) per ACTIVE email domain;
listDeliveryEvents runs a compartment-scoped Logging Search
(oci-logging / oci-loggingsearch 2.142.2).
- Job provider-delivery-log-poll: appSetting cursor with 10 min overlap,
1 day max lookback, ProcessedProviderLogEvent dedupe table (pruned after
3 days), truncation-safe cursor, enables logs on verified domains with a
30 min back-off on failures. DELIVERY_LOG_POLL_CRON default every minute.
- relay -> DELIVERED, bounce hard/soft -> Permanent/Transient with category,
code and SMTP status, complaint -> COMPLAINED; open/click/unsubscribe ignored.
- processEmailEvent skips a Delivery/Bounce/Complaint already recorded for
the same recipient (log poll vs suppression poll), counts usage once per
email and only adds hardBounced when a soft bounce turns permanent.
- Domain create/verify call ensureDeliveryLogs without failing on errors.
- Docs: IAM policy (manage log-groups, read log-content), env vars.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Cloud mode on in deploy (IS_CLOUD build arg): sign-ups without an
invite are waitlisted until the admin approves them; ADMIN_EMAIL required
- Warm-up daily caps by team age (50/200/1k/5k, plan limit after 30 days),
skipped for admin-verified teams
- Reputation guard job (every 10 min, 7-day window): warn at 2% hard
bounce / 0.05% complaint, pause at 4% / 0.1% (min 2 complaints);
records blockedReason/blockedAt and notifies team + admin
- Admin: block reason shown and kept in sync, team cache invalidated,
re-waitlisting an owner blocks their teams' sending
- System mail always relays through OCI when FROM_EMAIL is set (cloud
mode previously fell through to the upstream useSend cloud client)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- rename product to Scribase Mail across web app, emails, marketing and docs
- new monochrome mark/favicons and neutral black/white theme; remove emoji UI
- source code link (AGPL-3.0) in sidebar, login and unsubscribe pages
- rewrite marketing site and self-hosting docs for OCI Email Delivery,
add OCI notes page (event sources, unavailable features)
- add NOTICE and MERGE.md crediting useSend and listing changes
- add deploy/compose.scribase-mail.yml (web+postgres+redis, 1.47 GB limits),
deploy/.env.example, Caddy site and DEPLOY.md for mail.scribase.com
- replace legacy provider env vars in turbo.json, CI, env examples, docker files
- OCI SDK packages as server externals for the standalone build
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>