59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
/**
|
|
* SMTP Client Core Implementation
|
|
* Main client class with delegation to handlers
|
|
*/
|
|
import { EventEmitter } from 'node:events';
|
|
import type { Email } from '../../core/classes.email.js';
|
|
import type { ISmtpClientOptions, ISmtpSendResult, IConnectionPoolStatus } from './interfaces.js';
|
|
import type { ConnectionManager } from './connection-manager.js';
|
|
import type { CommandHandler } from './command-handler.js';
|
|
import type { AuthHandler } from './auth-handler.js';
|
|
import type { TlsHandler } from './tls-handler.js';
|
|
import type { SmtpErrorHandler } from './error-handler.js';
|
|
interface ISmtpClientDependencies {
|
|
options: ISmtpClientOptions;
|
|
connectionManager: ConnectionManager;
|
|
commandHandler: CommandHandler;
|
|
authHandler: AuthHandler;
|
|
tlsHandler: TlsHandler;
|
|
errorHandler: SmtpErrorHandler;
|
|
}
|
|
export declare class SmtpClient extends EventEmitter {
|
|
private options;
|
|
private connectionManager;
|
|
private commandHandler;
|
|
private authHandler;
|
|
private tlsHandler;
|
|
private errorHandler;
|
|
private isShuttingDown;
|
|
constructor(dependencies: ISmtpClientDependencies);
|
|
/**
|
|
* Send an email
|
|
*/
|
|
sendMail(email: Email): Promise<ISmtpSendResult>;
|
|
/**
|
|
* Test connection to SMTP server
|
|
*/
|
|
verify(): Promise<boolean>;
|
|
/**
|
|
* Check if client is connected
|
|
*/
|
|
isConnected(): boolean;
|
|
/**
|
|
* Get connection pool status
|
|
*/
|
|
getPoolStatus(): IConnectionPoolStatus;
|
|
/**
|
|
* Update client options
|
|
*/
|
|
updateOptions(newOptions: Partial<ISmtpClientOptions>): void;
|
|
/**
|
|
* Close all connections and shutdown client
|
|
*/
|
|
close(): Promise<void>;
|
|
private formatEmailData;
|
|
private extractMessageId;
|
|
private setupEventForwarding;
|
|
}
|
|
export {};
|