feat(platform): multi-account foundation for IMAP/SMTP mailboxes#2845
Draft
Israeltheminer wants to merge 1 commit into
Draft
feat(platform): multi-account foundation for IMAP/SMTP mailboxes#2845Israeltheminer wants to merge 1 commit into
Israeltheminer wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
First slice toward reworking
imap_smtpfrom 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
imapSmtpAccountValidator/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-accountrouting, and encryptedimapAuth/smtpAuth. SMTP is generic (the mailbox's own SMTP, any relay, or a self-hosted submission host) — no relay baked in.imapSmtpAccountsarray onintegrationCredentials(data-safe growth; the schema snapshot classifies it safe, so no migration), surfaced onLoadedIntegration.resolveImapSmtpConnectionaccepts an optionalaccountId: selects by id → theisDefaultaccount → the first; SMTP reuses the account's IMAP login unless it carries a distinctsmtpAuth. A pre-save dry-run keeps using the legacy inline path.Behavior
No user-visible change. With no
imapSmtpAccountsstored, 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.