78 lines
2.3 KiB
TypeScript
78 lines
2.3 KiB
TypeScript
/**
|
|
* SMTP Client Helper Functions
|
|
* Protocol helper functions and utilities
|
|
*/
|
|
import type { ISmtpResponse, ISmtpCapabilities } from '../interfaces.js';
|
|
/**
|
|
* Parse SMTP server response
|
|
*/
|
|
export declare function parseSmtpResponse(data: string): ISmtpResponse;
|
|
/**
|
|
* Parse EHLO response and extract capabilities
|
|
*/
|
|
export declare function parseEhloResponse(response: string): ISmtpCapabilities;
|
|
/**
|
|
* Format SMTP command with proper line ending
|
|
*/
|
|
export declare function formatCommand(command: string, ...args: string[]): string;
|
|
/**
|
|
* Encode authentication string for AUTH PLAIN
|
|
*/
|
|
export declare function encodeAuthPlain(username: string, password: string): string;
|
|
/**
|
|
* Encode authentication string for AUTH LOGIN
|
|
*/
|
|
export declare function encodeAuthLogin(value: string): string;
|
|
/**
|
|
* Generate OAuth2 authentication string
|
|
*/
|
|
export declare function generateOAuth2String(username: string, accessToken: string): string;
|
|
/**
|
|
* Check if response code indicates success
|
|
*/
|
|
export declare function isSuccessCode(code: number): boolean;
|
|
/**
|
|
* Check if response code indicates temporary failure
|
|
*/
|
|
export declare function isTemporaryFailure(code: number): boolean;
|
|
/**
|
|
* Check if response code indicates permanent failure
|
|
*/
|
|
export declare function isPermanentFailure(code: number): boolean;
|
|
/**
|
|
* Escape email address for SMTP commands
|
|
*/
|
|
export declare function escapeEmailAddress(email: string): string;
|
|
/**
|
|
* Extract email address from angle brackets
|
|
*/
|
|
export declare function extractEmailAddress(email: string): string;
|
|
/**
|
|
* Generate unique connection ID
|
|
*/
|
|
export declare function generateConnectionId(): string;
|
|
/**
|
|
* Format timeout duration for human readability
|
|
*/
|
|
export declare function formatTimeout(milliseconds: number): string;
|
|
/**
|
|
* Validate and normalize email data size
|
|
*/
|
|
export declare function validateEmailSize(emailData: string, maxSize?: number): boolean;
|
|
/**
|
|
* Clean sensitive data from logs
|
|
*/
|
|
export declare function sanitizeForLogging(data: any): any;
|
|
/**
|
|
* Calculate exponential backoff delay
|
|
*/
|
|
export declare function calculateBackoffDelay(attempt: number, baseDelay?: number): number;
|
|
/**
|
|
* Parse enhanced status code
|
|
*/
|
|
export declare function parseEnhancedStatusCode(code: string): {
|
|
class: number;
|
|
subject: number;
|
|
detail: number;
|
|
} | null;
|