/**
 * @bobfrankston/mailsend
 * Queue-based mail sender. Each account has its own queue directory.
 * Messages queued as .ltr (RFC 822) files, sent via SMTP with retry.
 * Supports password and OAuth2 (Gmail) authentication.
 *
 * Directory structure:
 *   {baseDir}/{accountId}/queue/    — pending .ltr files
 *   {baseDir}/{accountId}/sent/     — sent messages (optional, YYYY/MM/DD)
 *   {baseDir}/{accountId}/fail/     — failed messages for retry
 */
export interface SmtpConfig {
    host: string;
    port: number;
    secure?: boolean;
    auth: "password" | "oauth2";
    user: string;
    password?: string;
    /** Default From address, e.g. "Bob Frankston <bob@iecc.com>" */
    from?: string;
    tokenProvider?: () => Promise<string>;
}
export interface MailMessage {
    from: string;
    to: string[];
    cc?: string[];
    bcc?: string[];
    subject: string;
    html?: string;
    text?: string;
    inReplyTo?: string;
    references?: string;
    accountId?: string;
}
export interface MailSendConfig {
    /** Base directory for all queues */
    baseDir: string;
    /** SMTP configs keyed by account ID */
    accounts: Record<string, SmtpConfig>;
    /** Log sent messages to sent/ subdirectory */
    logSent?: boolean;
    /** Retry interval in ms (default: 5 minutes) */
    retryIntervalMs?: number;
    /** Default account ID */
    defaultAccount?: string;
}
export declare function buildRfc822(msg: MailMessage): string;
export declare class MailSender {
    private config;
    private processing;
    private retryTimer;
    constructor(config: MailSendConfig);
    private accountDir;
    private queueDir;
    private sentDir;
    private failDir;
    /** Queue a message. Returns the filename. */
    queueMessage(msg: MailMessage): string;
    /** Process pending messages for one account */
    processQueue(accountId: string): Promise<void>;
    /** Process all account queues */
    processAllQueues(): Promise<void>;
    private sendFile;
    /** Start background worker — retries failed, processes queues */
    startWorker(): void;
    private retryFailed;
    stopWorker(): void;
    /** Get queue status per account */
    getStatus(): Record<string, {
        pending: number;
        failed: number;
    }>;
}
export declare function initMailSend(config: MailSendConfig): MailSender;
export declare function getMailSender(): MailSender | null;
export declare function queueMessage(msg: MailMessage): string;
//# sourceMappingURL=index.d.ts.map