/**
 * SMTP Service for sending emails via Proton Mail (through Proton Bridge or
 * direct submission).
 */
import { ProtonMailConfig, SendEmailOptions } from "../types/index.js";
import { BackoffTracker } from "../utils/backoff.js";
/** Escape special HTML characters to prevent injection in email bodies */
export declare function escapeHtml(str: string): string;
export declare class SMTPService {
    private transporter;
    private config;
    /** True when TLS certificate validation is disabled (no Bridge cert configured). */
    insecureTls: boolean;
    /**
     * Actionable initialization error, or null on successful init. Populated
     * when the configured Bridge cert path cannot be loaded AND the user has
     * not opted into insecure mode. Construction itself NEVER throws — a
     * synchronous throw here would kill the MCP server at module load (stdio
     * servers have no chance to report structured errors to the client
     * before the transport comes up), so we defer the failure to the first
     * sendEmail() / verifyConnection() call where the error can propagate
     * back through the MCP response. reinitialize() clears this.
     */
    initError: string | null;
    /**
     * Tracks consecutive abuse-signal failures (SMTP 421/450/454 etc.) and
     * holds back sends during the exponential-backoff window. Surfaced via
     * getBackoffState() so get_connection_status can report throttling to
     * the agent rather than letting it keep hammering.
     */
    readonly backoff: BackoffTracker;
    constructor(config: ProtonMailConfig);
    private initializeTransporter;
    /**
     * Rebuild the transporter using the current config values.
     * Call this after credentials or cert path have been loaded into config
     * (i.e. after main() has populated smtp.password and smtp.bridgeCertPath).
     */
    reinitialize(): void;
    /** Verify the SMTP transporter can authenticate with the Bridge. Returns true on success. */
    verifyConnection(): Promise<boolean>;
    /**
     * Send an email via the Proton Bridge SMTP relay.
     * @param options Recipient(s), subject, body, attachments, and optional headers
     * @returns Object with success flag, SMTP messageId on success, or error string on failure
     */
    sendEmail(options: SendEmailOptions): Promise<{
        success: boolean;
        messageId?: string;
        error?: string;
    }>;
    /**
     * Send a diagnostic test email to verify end-to-end SMTP delivery.
     * @param to Recipient email address (must be a valid RFC 5321 address)
     * @param customMessage Optional HTML body to use instead of the default test message
     * @returns Object with success flag, SMTP messageId on success, or error string on failure
     */
    sendTestEmail(to: string, customMessage?: string): Promise<{
        success: boolean;
        messageId?: string;
        error?: string;
    }>;
    /** Close and release the SMTP transporter connection pool. */
    close(): Promise<void>;
    /** Securely wipe credential strings from memory. */
    wipeCredentials(): void;
}
//# sourceMappingURL=smtp-service.d.ts.map