import type { AuthMethod } from "./auth.mjs"; /** Knobs mirror what's user-visible on `SmtpDriverOptions`. Kept narrow so * this module is easy to unit-test. */ export interface ConnectionOptions { host: string; port: number; secure: boolean; requireTLS?: boolean; user?: string; password?: string; authMethod?: AuthMethod | "AUTO"; getAccessToken?: () => Promise; rejectUnauthorized?: boolean; tls?: import("node:tls").ConnectionOptions; localName: string; connectionTimeoutMs: number; commandTimeoutMs: number; } export interface Capabilities { authMethods: Set; starttls: boolean; size: number; smtputf8: boolean; } /** A live SMTP connection. `sendMessage` handles MAIL FROM → RCPT TO → * DATA; callers can reuse the same instance for multiple messages via * `reset()` (issues `RSET`). */ export interface SmtpConnection { id: number; capabilities: Capabilities; sendMessage: (envelope: { from: string; rcpt: string[]; }, body: string) => Promise; reset: () => Promise; quit: () => Promise; destroy: () => void; isOpen: () => boolean; } /** Establish an SMTP connection: TCP connect → optional implicit TLS → * EHLO → optional STARTTLS → re-EHLO → AUTH. Returns when ready to send. */ export declare function createConnection(opts: ConnectionOptions): Promise;