68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
|
|
/**
|
||
|
|
* SMTP Client Command Handler
|
||
|
|
* SMTP command sending and response parsing
|
||
|
|
*/
|
||
|
|
import { EventEmitter } from 'node:events';
|
||
|
|
import type { ISmtpConnection, ISmtpResponse, ISmtpClientOptions, ISmtpCapabilities } from './interfaces.js';
|
||
|
|
export declare class CommandHandler extends EventEmitter {
|
||
|
|
private options;
|
||
|
|
private responseBuffer;
|
||
|
|
private pendingCommand;
|
||
|
|
private commandTimeout;
|
||
|
|
constructor(options: ISmtpClientOptions);
|
||
|
|
/**
|
||
|
|
* Send EHLO command and parse capabilities
|
||
|
|
*/
|
||
|
|
sendEhlo(connection: ISmtpConnection, domain?: string): Promise<ISmtpCapabilities>;
|
||
|
|
/**
|
||
|
|
* Send MAIL FROM command
|
||
|
|
*/
|
||
|
|
sendMailFrom(connection: ISmtpConnection, fromAddress: string): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send RCPT TO command
|
||
|
|
*/
|
||
|
|
sendRcptTo(connection: ISmtpConnection, toAddress: string): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send DATA command
|
||
|
|
*/
|
||
|
|
sendData(connection: ISmtpConnection): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send email data content
|
||
|
|
*/
|
||
|
|
sendDataContent(connection: ISmtpConnection, emailData: string): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send RSET command
|
||
|
|
*/
|
||
|
|
sendRset(connection: ISmtpConnection): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send NOOP command
|
||
|
|
*/
|
||
|
|
sendNoop(connection: ISmtpConnection): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send QUIT command
|
||
|
|
*/
|
||
|
|
sendQuit(connection: ISmtpConnection): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send STARTTLS command
|
||
|
|
*/
|
||
|
|
sendStartTls(connection: ISmtpConnection): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send AUTH command
|
||
|
|
*/
|
||
|
|
sendAuth(connection: ISmtpConnection, method: string, credentials?: string): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send a generic SMTP command
|
||
|
|
*/
|
||
|
|
sendCommand(connection: ISmtpConnection, command: string): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Send raw data without command formatting
|
||
|
|
*/
|
||
|
|
sendRawData(connection: ISmtpConnection, data: string): Promise<ISmtpResponse>;
|
||
|
|
/**
|
||
|
|
* Wait for server greeting
|
||
|
|
*/
|
||
|
|
waitForGreeting(connection: ISmtpConnection): Promise<ISmtpResponse>;
|
||
|
|
private handleIncomingData;
|
||
|
|
private isCompleteResponse;
|
||
|
|
}
|