update
This commit is contained in:
266
ts/config/email.config.ts
Normal file
266
ts/config/email.config.ts
Normal file
@ -0,0 +1,266 @@
|
||||
import type { IBaseConfig, ITlsConfig, IQueueConfig, IRateLimitConfig, IMonitoringConfig } from './base.config.js';
|
||||
|
||||
/**
|
||||
* Email service configuration
|
||||
*/
|
||||
export interface IEmailConfig extends IBaseConfig {
|
||||
/**
|
||||
* Whether to use MTA for sending emails
|
||||
*/
|
||||
useMta?: boolean;
|
||||
|
||||
/**
|
||||
* MTA configuration
|
||||
*/
|
||||
mtaConfig?: IMtaConfig;
|
||||
|
||||
/**
|
||||
* Template configuration
|
||||
*/
|
||||
templateConfig?: {
|
||||
/**
|
||||
* Default sender email address
|
||||
*/
|
||||
from?: string;
|
||||
|
||||
/**
|
||||
* Default reply-to email address
|
||||
*/
|
||||
replyTo?: string;
|
||||
|
||||
/**
|
||||
* Default footer HTML
|
||||
*/
|
||||
footerHtml?: string;
|
||||
|
||||
/**
|
||||
* Default footer text
|
||||
*/
|
||||
footerText?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether to load templates from directory
|
||||
*/
|
||||
loadTemplatesFromDir?: boolean;
|
||||
|
||||
/**
|
||||
* Directory path for email templates
|
||||
*/
|
||||
templatesDir?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* MTA configuration
|
||||
*/
|
||||
export interface IMtaConfig {
|
||||
/**
|
||||
* SMTP server configuration
|
||||
*/
|
||||
smtp?: {
|
||||
/**
|
||||
* Whether to enable the SMTP server
|
||||
*/
|
||||
enabled?: boolean;
|
||||
|
||||
/**
|
||||
* Port to listen on
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* SMTP server hostname
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* Maximum allowed email size in bytes
|
||||
*/
|
||||
maxSize?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* TLS configuration
|
||||
*/
|
||||
tls?: ITlsConfig;
|
||||
|
||||
/**
|
||||
* Outbound email configuration
|
||||
*/
|
||||
outbound?: {
|
||||
/**
|
||||
* Maximum concurrent sending jobs
|
||||
*/
|
||||
concurrency?: number;
|
||||
|
||||
/**
|
||||
* Retry configuration
|
||||
*/
|
||||
retries?: {
|
||||
/**
|
||||
* Maximum number of retries per message
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* Initial delay between retries (milliseconds)
|
||||
*/
|
||||
delay?: number;
|
||||
|
||||
/**
|
||||
* Whether to use exponential backoff for retries
|
||||
*/
|
||||
useBackoff?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Rate limiting configuration
|
||||
*/
|
||||
rateLimit?: IRateLimitConfig;
|
||||
|
||||
/**
|
||||
* IP warmup configuration
|
||||
*/
|
||||
warmup?: {
|
||||
/**
|
||||
* Whether IP warmup is enabled
|
||||
*/
|
||||
enabled?: boolean;
|
||||
|
||||
/**
|
||||
* IP addresses to warm up
|
||||
*/
|
||||
ipAddresses?: string[];
|
||||
|
||||
/**
|
||||
* Target domains to warm up
|
||||
*/
|
||||
targetDomains?: string[];
|
||||
|
||||
/**
|
||||
* Allocation policy to use
|
||||
*/
|
||||
allocationPolicy?: string;
|
||||
|
||||
/**
|
||||
* Fallback percentage for ESP routing during warmup
|
||||
*/
|
||||
fallbackPercentage?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reputation monitoring configuration
|
||||
*/
|
||||
reputation?: IMonitoringConfig & {
|
||||
/**
|
||||
* Alert thresholds
|
||||
*/
|
||||
alertThresholds?: {
|
||||
/**
|
||||
* Minimum acceptable reputation score
|
||||
*/
|
||||
minReputationScore?: number;
|
||||
|
||||
/**
|
||||
* Maximum acceptable complaint rate
|
||||
*/
|
||||
maxComplaintRate?: number;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Security settings
|
||||
*/
|
||||
security?: {
|
||||
/**
|
||||
* Whether to use DKIM signing
|
||||
*/
|
||||
useDkim?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to verify inbound DKIM signatures
|
||||
*/
|
||||
verifyDkim?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to verify SPF on inbound
|
||||
*/
|
||||
verifySpf?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to verify DMARC on inbound
|
||||
*/
|
||||
verifyDmarc?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enforce DMARC policy
|
||||
*/
|
||||
enforceDmarc?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use TLS for outbound when available
|
||||
*/
|
||||
useTls?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to require valid certificates
|
||||
*/
|
||||
requireValidCerts?: boolean;
|
||||
|
||||
/**
|
||||
* Log level for email security events
|
||||
*/
|
||||
securityLogLevel?: 'info' | 'warn' | 'error';
|
||||
|
||||
/**
|
||||
* Whether to check IP reputation for inbound emails
|
||||
*/
|
||||
checkIPReputation?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to scan content for malicious payloads
|
||||
*/
|
||||
scanContent?: boolean;
|
||||
|
||||
/**
|
||||
* Action to take when malicious content is detected
|
||||
*/
|
||||
maliciousContentAction?: 'tag' | 'quarantine' | 'reject';
|
||||
|
||||
/**
|
||||
* Minimum threat score to trigger action
|
||||
*/
|
||||
threatScoreThreshold?: number;
|
||||
|
||||
/**
|
||||
* Whether to reject connections from high-risk IPs
|
||||
*/
|
||||
rejectHighRiskIPs?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Domains configuration
|
||||
*/
|
||||
domains?: {
|
||||
/**
|
||||
* List of domains that this MTA will handle as local
|
||||
*/
|
||||
local?: string[];
|
||||
|
||||
/**
|
||||
* Whether to auto-create DNS records
|
||||
*/
|
||||
autoCreateDnsRecords?: boolean;
|
||||
|
||||
/**
|
||||
* DKIM selector to use
|
||||
*/
|
||||
dkimSelector?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Queue configuration
|
||||
*/
|
||||
queue?: IQueueConfig;
|
||||
}
|
Reference in New Issue
Block a user