import * as plugins from '../plugins.js'; /** * Configuration for SMTP authentication */ export interface ISmtpAuthConfig { /** Whether authentication is required */ required?: boolean; /** Supported authentication methods */ methods?: ('PLAIN' | 'LOGIN' | 'OAUTH2')[]; /** Static user credentials */ users?: Array<{username: string, password: string}>; /** LDAP URL for authentication */ ldapUrl?: string; } /** * Configuration for TLS in SMTP connections */ export interface ISmtpTlsConfig { /** Path to certificate file */ certPath?: string; /** Path to key file */ keyPath?: string; /** Path to CA certificate */ caPath?: string; /** Minimum TLS version */ minVersion?: string; /** Whether to use STARTTLS upgrade or implicit TLS */ useStartTls?: boolean; /** Cipher suite for TLS */ ciphers?: string; } /** * Configuration for content scanning */ export interface IContentScannerConfig { /** Type of scanner */ type: 'spam' | 'virus' | 'attachment'; /** Threshold for spam detection */ threshold?: number; /** Action to take when content matches scanning criteria */ action: 'tag' | 'reject'; /** File extensions to block (for attachment scanner) */ blockedExtensions?: string[]; } /** * Configuration for email transformations */ export interface ITransformationConfig { /** Type of transformation */ type: string; /** Header name for adding/modifying headers */ header?: string; /** Header value for adding/modifying headers */ value?: string; /** Domains for DKIM signing */ domains?: string[]; /** Whether to append to existing header or replace */ append?: boolean; /** Additional transformation parameters */ [key: string]: any; } /** * Configuration for DKIM signing */ export interface IDkimConfig { /** Domain name for DKIM signature */ domainName: string; /** Selector for DKIM */ keySelector: string; /** Private key for DKIM signing */ privateKey: string; } /** * Domain-specific routing configuration */ export interface ISmtpDomainConfig { /** Domains this configuration applies to */ domains: string[]; /** Target SMTP servers for this domain */ targetIPs: string[]; /** Target port */ port?: number; /** Whether to use TLS when connecting to target */ useTls?: boolean; /** Authentication credentials for target server */ authentication?: { user?: string; pass?: string; }; /** Allowed client IPs */ allowedIPs?: string[]; /** Rate limits for this domain */ rateLimits?: { maxMessagesPerMinute?: number; maxRecipientsPerMessage?: number; }; /** Whether to add custom headers */ addHeaders?: boolean; /** Headers to add */ headerInfo?: Array<{ name: string; value: string; }>; /** Whether to sign emails with DKIM */ signDkim?: boolean; /** DKIM configuration */ dkimOptions?: IDkimConfig; } /** * Queue configuration */ export interface IQueueConfig { /** Storage type for queue */ storageType?: 'memory' | 'disk'; /** Path for disk storage */ persistentPath?: string; /** Maximum retry attempts */ maxRetries?: number; /** Base delay between retries (ms) */ baseRetryDelay?: number; /** Maximum delay between retries (ms) */ maxRetryDelay?: number; /** Maximum queue size */ maxQueueSize?: number; } /** * Complete SMTP configuration */ export interface ISmtpConfig { /** SMTP ports to listen on */ ports: number[]; /** Hostname for SMTP server */ hostname: string; /** Banner text for SMTP server */ banner?: string; /** Maximum message size in bytes */ maxMessageSize?: number; /** TLS configuration */ tls?: ISmtpTlsConfig; /** Authentication configuration */ auth?: ISmtpAuthConfig; /** Domain-specific configurations */ domainConfigs: ISmtpDomainConfig[]; /** Default routing */ defaultServer: string; defaultPort?: number; useTls?: boolean; /** Content scanning configuration */ contentScanning?: boolean; scanners?: IContentScannerConfig[]; /** Message transformations */ transformations?: ITransformationConfig[]; /** Queue configuration */ queue?: IQueueConfig; }