feat: implement comprehensive route-based email routing system

Replace legacy domain-rule based routing with flexible route-based system that supports:
- Multi-criteria matching (recipients, senders, IPs, authentication)
- Four action types (forward, process, deliver, reject)
- Moved DKIM signing to delivery phase for signature validity
- Connection pooling for efficient email forwarding
- Pattern caching for improved performance

This provides more granular control over email routing with priority-based matching and comprehensive test coverage.
This commit is contained in:
2025-05-28 13:23:45 +00:00
parent 88099e120a
commit 2e75961d1c
11 changed files with 717 additions and 168 deletions

View File

@ -81,6 +81,43 @@ export interface IEmailAction {
queue?: 'normal' | 'priority' | 'bulk';
};
/** Options for various action types */
options?: {
/** MTA specific options */
mtaOptions?: {
domain?: string;
allowLocalDelivery?: boolean;
localDeliveryPath?: string;
dkimSign?: boolean;
dkimOptions?: {
domainName: string;
keySelector: string;
privateKey?: string;
};
smtpBanner?: string;
maxConnections?: number;
connTimeout?: number;
spoolDir?: string;
};
/** Content scanning configuration */
contentScanning?: boolean;
scanners?: Array<{
type: 'spam' | 'virus' | 'attachment';
threshold?: number;
action: 'tag' | 'reject';
blockedExtensions?: string[];
}>;
/** Email transformations */
transformations?: Array<{
type: string;
header?: string;
value?: string;
domains?: string[];
append?: boolean;
[key: string]: any;
}>;
};
/** Delivery options (applies to forward/process/deliver) */
delivery?: {
/** Rate limit (messages per minute) */