Skip to content

feat(platform): multi-account foundation for IMAP/SMTP mailboxes#2845

Draft
Israeltheminer wants to merge 1 commit into
mainfrom
feat/imap-multiaccount-foundation
Draft

feat(platform): multi-account foundation for IMAP/SMTP mailboxes#2845
Israeltheminer wants to merge 1 commit into
mainfrom
feat/imap-multiaccount-foundation

Conversation

@Israeltheminer

Copy link
Copy Markdown
Collaborator

What & why

First slice toward reworking imap_smtp from a single catch-all mailbox into several real mailboxes under one Email integration, with provider-agnostic outbound. Foundation only — purely additive and behavior-preserving; the sync, per-account routing, and settings/compose UI that consume it land in follow-up PRs.

Changes

  • Account shapeimapSmtpAccountValidator / imapSmtpAccountEncryptedValidator (+ inferred types). Each account carries its own From address, IMAP + SMTP/relay host/port/TLS (typed — not the old string-parsed booleans), sentMailbox, isDefault, per-account routing, and encrypted imapAuth/smtpAuth. SMTP is generic (the mailbox's own SMTP, any relay, or a self-hosted submission host) — no relay baked in.
  • Storage — optional imapSmtpAccounts array on integrationCredentials (data-safe growth; the schema snapshot classifies it safe, so no migration), surfaced on LoadedIntegration.
  • ResolverresolveImapSmtpConnection accepts an optional accountId: selects by id → the isDefault account → the first; SMTP reuses the account's IMAP login unless it carries a distinct smtpAuth. A pre-save dry-run keeps using the legacy inline path.

Behavior

No user-visible change. With no imapSmtpAccounts stored, resolution is byte-for-byte today's single-mailbox path (proven by the retained legacy tests).

Tests / gates

imap_smtp_config.test.ts: 5 retained legacy + 5 new multi-account cases (account selection, default/first fallback, distinct SMTP relay, unknown-id error, legacy dry-run precedence). Green: tsc --noEmit, oxlint, oxfmt, migrations:check.

Add the storage shape and connection resolution for holding several real
mailbox accounts under one imap_smtp integration, ahead of the UI and sync
that will consume it. Purely additive and behavior-preserving: with no
accounts stored, resolution falls through to today's single-mailbox path.

- imapSmtpAccountValidator / imapSmtpAccountEncryptedValidator and inferred
  types: id, From address, per-account IMAP + SMTP/relay host/port/TLS
  (typed, not string-parsed), sentMailbox, isDefault, routing, and encrypted
  per-account imapAuth/smtpAuth. SMTP is generic (mailbox login, any relay,
  or a self-hosted submission host) — no relay baked in.
- Optional imapSmtpAccounts array on integrationCredentials (data-safe
  growth; snapshot classifies it safe, no migration) surfaced on
  LoadedIntegration.
- resolveImapSmtpConnection accepts an optional accountId: selects the
  account by id, else the one flagged default, else the first; SMTP reuses
  the account's IMAP login unless it carries a distinct smtpAuth. A pre-save
  dry-run keeps using the legacy inline path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant