131 lines
4.1 KiB
TypeScript
131 lines
4.1 KiB
TypeScript
|
|
/**
|
||
|
|
* SMTP Server Constants
|
||
|
|
* This file contains all constants and enums used by the SMTP server
|
||
|
|
*/
|
||
|
|
import { SmtpState } from '../interfaces.js';
|
||
|
|
export { SmtpState };
|
||
|
|
/**
|
||
|
|
* SMTP Response Codes
|
||
|
|
* Based on RFC 5321 and common SMTP practice
|
||
|
|
*/
|
||
|
|
export declare enum SmtpResponseCode {
|
||
|
|
SUCCESS = 250,// Requested mail action okay, completed
|
||
|
|
SYSTEM_STATUS = 211,// System status, or system help reply
|
||
|
|
HELP_MESSAGE = 214,// Help message
|
||
|
|
SERVICE_READY = 220,// <domain> Service ready
|
||
|
|
SERVICE_CLOSING = 221,// <domain> Service closing transmission channel
|
||
|
|
AUTHENTICATION_SUCCESSFUL = 235,// Authentication successful
|
||
|
|
OK = 250,// Requested mail action okay, completed
|
||
|
|
FORWARD = 251,// User not local; will forward to <forward-path>
|
||
|
|
CANNOT_VRFY = 252,// Cannot VRFY user, but will accept message and attempt delivery
|
||
|
|
MORE_INFO_NEEDED = 334,// Server challenge for authentication
|
||
|
|
START_MAIL_INPUT = 354,// Start mail input; end with <CRLF>.<CRLF>
|
||
|
|
SERVICE_NOT_AVAILABLE = 421,// <domain> Service not available, closing transmission channel
|
||
|
|
MAILBOX_TEMPORARILY_UNAVAILABLE = 450,// Requested mail action not taken: mailbox unavailable
|
||
|
|
LOCAL_ERROR = 451,// Requested action aborted: local error in processing
|
||
|
|
INSUFFICIENT_STORAGE = 452,// Requested action not taken: insufficient system storage
|
||
|
|
TLS_UNAVAILABLE_TEMP = 454,// TLS not available due to temporary reason
|
||
|
|
SYNTAX_ERROR = 500,// Syntax error, command unrecognized
|
||
|
|
SYNTAX_ERROR_PARAMETERS = 501,// Syntax error in parameters or arguments
|
||
|
|
COMMAND_NOT_IMPLEMENTED = 502,// Command not implemented
|
||
|
|
BAD_SEQUENCE = 503,// Bad sequence of commands
|
||
|
|
COMMAND_PARAMETER_NOT_IMPLEMENTED = 504,// Command parameter not implemented
|
||
|
|
AUTH_REQUIRED = 530,// Authentication required
|
||
|
|
AUTH_FAILED = 535,// Authentication credentials invalid
|
||
|
|
MAILBOX_UNAVAILABLE = 550,// Requested action not taken: mailbox unavailable
|
||
|
|
USER_NOT_LOCAL = 551,// User not local; please try <forward-path>
|
||
|
|
EXCEEDED_STORAGE = 552,// Requested mail action aborted: exceeded storage allocation
|
||
|
|
MAILBOX_NAME_INVALID = 553,// Requested action not taken: mailbox name not allowed
|
||
|
|
TRANSACTION_FAILED = 554,// Transaction failed
|
||
|
|
MAIL_RCPT_PARAMETERS_INVALID = 555
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* SMTP Command Types
|
||
|
|
*/
|
||
|
|
export declare enum SmtpCommand {
|
||
|
|
HELO = "HELO",
|
||
|
|
EHLO = "EHLO",
|
||
|
|
MAIL_FROM = "MAIL",
|
||
|
|
RCPT_TO = "RCPT",
|
||
|
|
DATA = "DATA",
|
||
|
|
RSET = "RSET",
|
||
|
|
NOOP = "NOOP",
|
||
|
|
QUIT = "QUIT",
|
||
|
|
STARTTLS = "STARTTLS",
|
||
|
|
AUTH = "AUTH",
|
||
|
|
HELP = "HELP",
|
||
|
|
VRFY = "VRFY",
|
||
|
|
EXPN = "EXPN"
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Security log event types
|
||
|
|
*/
|
||
|
|
export declare enum SecurityEventType {
|
||
|
|
CONNECTION = "connection",
|
||
|
|
AUTHENTICATION = "authentication",
|
||
|
|
COMMAND = "command",
|
||
|
|
DATA = "data",
|
||
|
|
IP_REPUTATION = "ip_reputation",
|
||
|
|
TLS_NEGOTIATION = "tls_negotiation",
|
||
|
|
DKIM = "dkim",
|
||
|
|
SPF = "spf",
|
||
|
|
DMARC = "dmarc",
|
||
|
|
EMAIL_VALIDATION = "email_validation",
|
||
|
|
SPAM = "spam",
|
||
|
|
ACCESS_CONTROL = "access_control"
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Security log levels
|
||
|
|
*/
|
||
|
|
export declare enum SecurityLogLevel {
|
||
|
|
DEBUG = "debug",
|
||
|
|
INFO = "info",
|
||
|
|
WARN = "warn",
|
||
|
|
ERROR = "error"
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* SMTP Server Defaults
|
||
|
|
*/
|
||
|
|
export declare const SMTP_DEFAULTS: {
|
||
|
|
CONNECTION_TIMEOUT: number;
|
||
|
|
SOCKET_TIMEOUT: number;
|
||
|
|
DATA_TIMEOUT: number;
|
||
|
|
CLEANUP_INTERVAL: number;
|
||
|
|
MAX_CONNECTIONS: number;
|
||
|
|
MAX_RECIPIENTS: number;
|
||
|
|
MAX_MESSAGE_SIZE: number;
|
||
|
|
SMTP_PORT: number;
|
||
|
|
SUBMISSION_PORT: number;
|
||
|
|
SECURE_PORT: number;
|
||
|
|
HOSTNAME: string;
|
||
|
|
CRLF: string;
|
||
|
|
};
|
||
|
|
/**
|
||
|
|
* SMTP Command Patterns
|
||
|
|
* Regular expressions for parsing SMTP commands
|
||
|
|
*/
|
||
|
|
export declare const SMTP_PATTERNS: {
|
||
|
|
EHLO: RegExp;
|
||
|
|
MAIL_FROM: RegExp;
|
||
|
|
RCPT_TO: RegExp;
|
||
|
|
PARAM: RegExp;
|
||
|
|
EMAIL: RegExp;
|
||
|
|
END_DATA: RegExp;
|
||
|
|
};
|
||
|
|
/**
|
||
|
|
* SMTP Extension List
|
||
|
|
* These extensions are advertised in the EHLO response
|
||
|
|
*/
|
||
|
|
export declare const SMTP_EXTENSIONS: {
|
||
|
|
PIPELINING: string;
|
||
|
|
SIZE: string;
|
||
|
|
EIGHTBITMIME: string;
|
||
|
|
STARTTLS: string;
|
||
|
|
AUTH: string;
|
||
|
|
ENHANCEDSTATUSCODES: string;
|
||
|
|
HELP: string;
|
||
|
|
CHUNKING: string;
|
||
|
|
DSN: string;
|
||
|
|
formatExtension(name: string, parameter?: string | number): string;
|
||
|
|
};
|