/** * Configuration Parser * Parses EMAIL_CREDENTIALS env var and auto-discovers IMAP/SMTP settings */ import type { OAuth2Tokens } from './oauth2.js'; export interface ServerConfig { host: string; port: number; secure: boolean; } export interface AccountConfig { id: string; email: string; password: string; authType?: 'password' | 'oauth2'; imap: ServerConfig; smtp: ServerConfig; oauth2?: OAuth2Tokens; } export type SmtpSecurity = 'tls' | 'ssl' | 'starttls' | 'none'; /** * Parse EMAIL_CREDENTIALS environment variable * * Supported formats: * - Simple: email1:password1,email2:password2 * - Custom IMAP host: email1:password1:imap.custom.com,email2:password2 * - Custom IMAP host + port: email:password:imap.custom.com:1993 * - Custom IMAP + SMTP (closes #634): email:password:imap.custom.com:993:smtp.custom.com:587:starttls * - SMTP host alone: email:password:imap.custom.com:993:smtp.custom.com (port 587, starttls) * - SMTP host + port: email:password:imap.custom.com:993:smtp.custom.com:587 (starttls) * - SMTP security keyword: `tls` / `ssl` (implicit TLS, default port 465) | * `starttls` (STARTTLS upgrade, default port 587) | `none` (plain, port 25) * - Local IMAP proxy: email:password:localhost:1993 (the literal `localhost` * is accepted as a host even though it has no dot; each account may use its * own host and port) * - Passwords with commas are NOT supported (use env var per account instead) * * For passwords containing colons, append the host segment to disambiguate: * email:password_with:colon:imap_host */ export declare function parseCredentials(envValue: string): Promise; /** * Load and validate configuration from environment */ export declare function loadConfig(): Promise; export declare function resolveAccount(accounts: AccountConfig[], query: string): AccountConfig; /** * Resolve a single account, with optional filter. * When filter is omitted and there's exactly one account, returns it. * Throws AMBIGUOUS_ACCOUNT if multiple accounts match. */ export declare function resolveSingleAccount(accounts: AccountConfig[], accountFilter?: string): AccountConfig; export declare function resolveAccounts(accounts: AccountConfig[], query?: string): AccountConfig[]; //# sourceMappingURL=config.d.ts.map