@push.rocks/smartmta 5.1.3 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +7 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/index.d.ts +3 -0
- package/dist_ts/index.js +4 -0
- package/dist_ts/logger.d.ts +17 -0
- package/dist_ts/logger.js +76 -0
- package/dist_ts/mail/core/classes.bouncemanager.d.ts +185 -0
- package/dist_ts/mail/core/classes.bouncemanager.js +569 -0
- package/dist_ts/mail/core/classes.email.d.ts +291 -0
- package/dist_ts/mail/core/classes.email.js +802 -0
- package/dist_ts/mail/core/classes.emailvalidator.d.ts +61 -0
- package/dist_ts/mail/core/classes.emailvalidator.js +184 -0
- package/dist_ts/mail/core/classes.templatemanager.d.ts +95 -0
- package/dist_ts/mail/core/classes.templatemanager.js +240 -0
- package/dist_ts/mail/core/index.d.ts +4 -0
- package/dist_ts/mail/core/index.js +6 -0
- package/dist_ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
- package/dist_ts/mail/delivery/classes.delivery.queue.js +488 -0
- package/dist_ts/mail/delivery/classes.delivery.system.d.ts +160 -0
- package/dist_ts/mail/delivery/classes.delivery.system.js +630 -0
- package/dist_ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
- package/dist_ts/mail/delivery/classes.unified.rate.limiter.js +820 -0
- package/dist_ts/mail/delivery/index.d.ts +4 -0
- package/dist_ts/mail/delivery/index.js +6 -0
- package/dist_ts/mail/delivery/interfaces.d.ts +140 -0
- package/dist_ts/mail/delivery/interfaces.js +17 -0
- package/dist_ts/mail/index.d.ts +7 -0
- package/dist_ts/mail/index.js +12 -0
- package/dist_ts/mail/routing/classes.dkim.manager.d.ts +25 -0
- package/dist_ts/mail/routing/classes.dkim.manager.js +127 -0
- package/dist_ts/mail/routing/classes.dns.manager.d.ts +79 -0
- package/dist_ts/mail/routing/classes.dns.manager.js +415 -0
- package/dist_ts/mail/routing/classes.domain.registry.d.ts +54 -0
- package/dist_ts/mail/routing/classes.domain.registry.js +119 -0
- package/dist_ts/mail/routing/classes.email.action.executor.d.ts +33 -0
- package/dist_ts/mail/routing/classes.email.action.executor.js +137 -0
- package/dist_ts/mail/routing/classes.email.router.d.ts +171 -0
- package/dist_ts/mail/routing/classes.email.router.js +494 -0
- package/dist_ts/mail/routing/classes.unified.email.server.d.ts +241 -0
- package/dist_ts/mail/routing/classes.unified.email.server.js +935 -0
- package/dist_ts/mail/routing/index.d.ts +7 -0
- package/dist_ts/mail/routing/index.js +9 -0
- package/dist_ts/mail/routing/interfaces.d.ts +187 -0
- package/dist_ts/mail/routing/interfaces.js +2 -0
- package/dist_ts/mail/security/classes.dkimcreator.d.ts +72 -0
- package/dist_ts/mail/security/classes.dkimcreator.js +360 -0
- package/dist_ts/mail/security/classes.spfverifier.d.ts +62 -0
- package/dist_ts/mail/security/classes.spfverifier.js +87 -0
- package/dist_ts/mail/security/index.d.ts +2 -0
- package/dist_ts/mail/security/index.js +4 -0
- package/dist_ts/paths.d.ts +14 -0
- package/dist_ts/paths.js +39 -0
- package/dist_ts/plugins.d.ts +24 -0
- package/dist_ts/plugins.js +28 -0
- package/dist_ts/security/classes.contentscanner.d.ts +130 -0
- package/dist_ts/security/classes.contentscanner.js +338 -0
- package/dist_ts/security/classes.ipreputationchecker.d.ts +73 -0
- package/dist_ts/security/classes.ipreputationchecker.js +263 -0
- package/dist_ts/security/classes.rustsecuritybridge.d.ts +398 -0
- package/dist_ts/security/classes.rustsecuritybridge.js +484 -0
- package/dist_ts/security/classes.securitylogger.d.ts +140 -0
- package/dist_ts/security/classes.securitylogger.js +235 -0
- package/dist_ts/security/index.d.ts +4 -0
- package/dist_ts/security/index.js +5 -0
- package/package.json +6 -1
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/index.ts +3 -0
- package/ts/logger.ts +91 -0
- package/ts/mail/core/classes.bouncemanager.ts +731 -0
- package/ts/mail/core/classes.email.ts +942 -0
- package/ts/mail/core/classes.emailvalidator.ts +239 -0
- package/ts/mail/core/classes.templatemanager.ts +320 -0
- package/ts/mail/core/index.ts +5 -0
- package/ts/mail/delivery/classes.delivery.queue.ts +645 -0
- package/ts/mail/delivery/classes.delivery.system.ts +816 -0
- package/ts/mail/delivery/classes.unified.rate.limiter.ts +1053 -0
- package/ts/mail/delivery/index.ts +5 -0
- package/ts/mail/delivery/interfaces.ts +167 -0
- package/ts/mail/index.ts +17 -0
- package/ts/mail/routing/classes.dkim.manager.ts +157 -0
- package/ts/mail/routing/classes.dns.manager.ts +573 -0
- package/ts/mail/routing/classes.domain.registry.ts +139 -0
- package/ts/mail/routing/classes.email.action.executor.ts +175 -0
- package/ts/mail/routing/classes.email.router.ts +575 -0
- package/ts/mail/routing/classes.unified.email.server.ts +1207 -0
- package/ts/mail/routing/index.ts +9 -0
- package/ts/mail/routing/interfaces.ts +202 -0
- package/ts/mail/security/classes.dkimcreator.ts +447 -0
- package/ts/mail/security/classes.spfverifier.ts +126 -0
- package/ts/mail/security/index.ts +3 -0
- package/ts/paths.ts +48 -0
- package/ts/plugins.ts +53 -0
- package/ts/security/classes.contentscanner.ts +400 -0
- package/ts/security/classes.ipreputationchecker.ts +315 -0
- package/ts/security/classes.rustsecuritybridge.ts +943 -0
- package/ts/security/classes.securitylogger.ts +299 -0
- package/ts/security/index.ts +40 -0
package/changelog.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-02-11 - 5.2.0 - feat(packaging)
|
|
4
|
+
add package exports entry, include ts/dist_ts in package files, and add TS barrel index re-exports
|
|
5
|
+
|
|
6
|
+
- package.json: add "exports" mapping "." -> "./dist_ts/index.js" to provide a module entry point
|
|
7
|
+
- package.json: add "ts/**/*" and "dist_ts/**/*" to "files" so TypeScript sources and built output are published
|
|
8
|
+
- ts/index.ts: new barrel that re-exports './00_commitinfo_data.js', './mail/index.js', and './security/index.js'
|
|
9
|
+
|
|
3
10
|
## 2026-02-11 - 5.1.3 - fix(docs)
|
|
4
11
|
clarify sendEmail default behavior and document automatic MX discovery and delivery modes
|
|
5
12
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* autocreated commitinfo by @push.rocks/commitinfo
|
|
3
|
+
*/
|
|
4
|
+
export const commitinfo = {
|
|
5
|
+
name: '@push.rocks/smartmta',
|
|
6
|
+
version: '5.2.0',
|
|
7
|
+
description: 'A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with Rust acceleration.'
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxzQkFBc0I7SUFDNUIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHlIQUF5SDtDQUN2SSxDQUFBIn0=
|
package/dist_ts/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './00_commitinfo_data.js';
|
|
2
|
+
export * from './mail/index.js';
|
|
3
|
+
export * from './security/index.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHlCQUF5QixDQUFDO0FBQ3hDLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxxQkFBcUIsQ0FBQyJ9
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare class StandardLogger {
|
|
2
|
+
private defaultContext;
|
|
3
|
+
private correlationId;
|
|
4
|
+
constructor();
|
|
5
|
+
log(level: 'error' | 'warn' | 'info' | 'success' | 'debug', message: string, context?: Record<string, any>): void;
|
|
6
|
+
error(message: string, context?: Record<string, any>): void;
|
|
7
|
+
warn(message: string, context?: Record<string, any>): void;
|
|
8
|
+
info(message: string, context?: Record<string, any>): void;
|
|
9
|
+
success(message: string, context?: Record<string, any>): void;
|
|
10
|
+
debug(message: string, context?: Record<string, any>): void;
|
|
11
|
+
setContext(context: Record<string, any>, overwrite?: boolean): void;
|
|
12
|
+
setCorrelationId(id?: string | null): string;
|
|
13
|
+
getCorrelationId(): string | null;
|
|
14
|
+
clearCorrelationId(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const logger: StandardLogger;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
// Map NODE_ENV to valid TEnvironment
|
|
4
|
+
const nodeEnv = process.env.NODE_ENV || 'production';
|
|
5
|
+
const envMap = {
|
|
6
|
+
'development': 'local',
|
|
7
|
+
'test': 'test',
|
|
8
|
+
'staging': 'staging',
|
|
9
|
+
'production': 'production'
|
|
10
|
+
};
|
|
11
|
+
// Default Smartlog instance
|
|
12
|
+
const baseLogger = new plugins.smartlog.Smartlog({
|
|
13
|
+
logContext: {
|
|
14
|
+
environment: envMap[nodeEnv] || 'production',
|
|
15
|
+
runtime: 'node',
|
|
16
|
+
zone: 'serve.zone',
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
// Extended logger compatible with the original enhanced logger API
|
|
20
|
+
class StandardLogger {
|
|
21
|
+
defaultContext = {};
|
|
22
|
+
correlationId = null;
|
|
23
|
+
constructor() { }
|
|
24
|
+
// Log methods
|
|
25
|
+
log(level, message, context = {}) {
|
|
26
|
+
const combinedContext = {
|
|
27
|
+
...this.defaultContext,
|
|
28
|
+
...context
|
|
29
|
+
};
|
|
30
|
+
if (this.correlationId) {
|
|
31
|
+
combinedContext.correlation_id = this.correlationId;
|
|
32
|
+
}
|
|
33
|
+
baseLogger.log(level, message, combinedContext);
|
|
34
|
+
}
|
|
35
|
+
error(message, context = {}) {
|
|
36
|
+
this.log('error', message, context);
|
|
37
|
+
}
|
|
38
|
+
warn(message, context = {}) {
|
|
39
|
+
this.log('warn', message, context);
|
|
40
|
+
}
|
|
41
|
+
info(message, context = {}) {
|
|
42
|
+
this.log('info', message, context);
|
|
43
|
+
}
|
|
44
|
+
success(message, context = {}) {
|
|
45
|
+
this.log('success', message, context);
|
|
46
|
+
}
|
|
47
|
+
debug(message, context = {}) {
|
|
48
|
+
this.log('debug', message, context);
|
|
49
|
+
}
|
|
50
|
+
// Context management
|
|
51
|
+
setContext(context, overwrite = false) {
|
|
52
|
+
if (overwrite) {
|
|
53
|
+
this.defaultContext = context;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.defaultContext = {
|
|
57
|
+
...this.defaultContext,
|
|
58
|
+
...context
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Correlation ID management
|
|
63
|
+
setCorrelationId(id = null) {
|
|
64
|
+
this.correlationId = id || randomUUID();
|
|
65
|
+
return this.correlationId;
|
|
66
|
+
}
|
|
67
|
+
getCorrelationId() {
|
|
68
|
+
return this.correlationId;
|
|
69
|
+
}
|
|
70
|
+
clearCorrelationId() {
|
|
71
|
+
this.correlationId = null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Export a singleton instance
|
|
75
|
+
export const logger = new StandardLogger();
|
|
76
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbG9nZ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DLGNBQWMsR0FBRztnQkFDcEIsR0FBRyxJQUFJLENBQUMsY0FBYztnQkFDdEIsR0FBRyxPQUFPO2FBQ1gsQ0FBQztRQUNKLENBQUM7SUFDSCxDQUFDO0lBRUQsNEJBQTRCO0lBQ3JCLGdCQUFnQixDQUFDLEtBQW9CLElBQUk7UUFDOUMsSUFBSSxDQUFDLGFBQWEsR0FBRyxFQUFFLElBQUksVUFBVSxFQUFFLENBQUM7UUFDeEMsT0FBTyxJQUFJLENBQUMsYUFBYSxDQUFDO0lBQzVCLENBQUM7SUFFTSxnQkFBZ0I7UUFDckIsT0FBTyxJQUFJLENBQUMsYUFBYSxDQUFDO0lBQzVCLENBQUM7SUFFTSxrQkFBa0I7UUFDdkIsSUFBSSxDQUFDLGFBQWEsR0FBRyxJQUFJLENBQUM7SUFDNUIsQ0FBQztDQUNGO0FBRUQsOEJBQThCO0FBQzlCLE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBRyxJQUFJLGNBQWMsRUFBRSxDQUFDIn0=
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { Email } from './classes.email.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bounce types for categorizing the reasons for bounces
|
|
4
|
+
*/
|
|
5
|
+
export declare enum BounceType {
|
|
6
|
+
INVALID_RECIPIENT = "invalid_recipient",
|
|
7
|
+
DOMAIN_NOT_FOUND = "domain_not_found",
|
|
8
|
+
MAILBOX_FULL = "mailbox_full",
|
|
9
|
+
MAILBOX_INACTIVE = "mailbox_inactive",
|
|
10
|
+
BLOCKED = "blocked",
|
|
11
|
+
SPAM_RELATED = "spam_related",
|
|
12
|
+
POLICY_RELATED = "policy_related",
|
|
13
|
+
SERVER_UNAVAILABLE = "server_unavailable",
|
|
14
|
+
TEMPORARY_FAILURE = "temporary_failure",
|
|
15
|
+
QUOTA_EXCEEDED = "quota_exceeded",
|
|
16
|
+
NETWORK_ERROR = "network_error",
|
|
17
|
+
TIMEOUT = "timeout",
|
|
18
|
+
AUTO_RESPONSE = "auto_response",
|
|
19
|
+
CHALLENGE_RESPONSE = "challenge_response",
|
|
20
|
+
UNKNOWN = "unknown"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Hard vs soft bounce classification
|
|
24
|
+
*/
|
|
25
|
+
export declare enum BounceCategory {
|
|
26
|
+
HARD = "hard",
|
|
27
|
+
SOFT = "soft",
|
|
28
|
+
AUTO_RESPONSE = "auto_response",
|
|
29
|
+
UNKNOWN = "unknown"
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Bounce data structure
|
|
33
|
+
*/
|
|
34
|
+
export interface BounceRecord {
|
|
35
|
+
id: string;
|
|
36
|
+
originalEmailId?: string;
|
|
37
|
+
recipient: string;
|
|
38
|
+
sender: string;
|
|
39
|
+
domain: string;
|
|
40
|
+
subject?: string;
|
|
41
|
+
bounceType: BounceType;
|
|
42
|
+
bounceCategory: BounceCategory;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
smtpResponse?: string;
|
|
45
|
+
diagnosticCode?: string;
|
|
46
|
+
statusCode?: string;
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
processed: boolean;
|
|
49
|
+
retryCount?: number;
|
|
50
|
+
nextRetryTime?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Retry strategy configuration for soft bounces
|
|
54
|
+
*/
|
|
55
|
+
interface RetryStrategy {
|
|
56
|
+
maxRetries: number;
|
|
57
|
+
initialDelay: number;
|
|
58
|
+
maxDelay: number;
|
|
59
|
+
backoffFactor: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Manager for handling email bounces
|
|
63
|
+
*/
|
|
64
|
+
export declare class BounceManager {
|
|
65
|
+
private retryStrategy;
|
|
66
|
+
private bounceStore;
|
|
67
|
+
private bounceCache;
|
|
68
|
+
private suppressionList;
|
|
69
|
+
private storageManager?;
|
|
70
|
+
constructor(options?: {
|
|
71
|
+
retryStrategy?: Partial<RetryStrategy>;
|
|
72
|
+
maxCacheSize?: number;
|
|
73
|
+
cacheTTL?: number;
|
|
74
|
+
storageManager?: any;
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Process a bounce notification
|
|
78
|
+
* @param bounceData Bounce data to process
|
|
79
|
+
* @returns Processed bounce record
|
|
80
|
+
*/
|
|
81
|
+
processBounce(bounceData: Partial<BounceRecord>): Promise<BounceRecord>;
|
|
82
|
+
/**
|
|
83
|
+
* Process an SMTP failure as a bounce
|
|
84
|
+
* @param recipient Recipient email
|
|
85
|
+
* @param smtpResponse SMTP error response
|
|
86
|
+
* @param options Additional options
|
|
87
|
+
* @returns Processed bounce record
|
|
88
|
+
*/
|
|
89
|
+
processSmtpFailure(recipient: string, smtpResponse: string, options?: {
|
|
90
|
+
sender?: string;
|
|
91
|
+
originalEmailId?: string;
|
|
92
|
+
statusCode?: string;
|
|
93
|
+
headers?: Record<string, string>;
|
|
94
|
+
}): Promise<BounceRecord>;
|
|
95
|
+
/**
|
|
96
|
+
* Process a bounce notification email
|
|
97
|
+
* @param bounceEmail The email containing bounce information
|
|
98
|
+
* @returns Processed bounce record or null if not a bounce
|
|
99
|
+
*/
|
|
100
|
+
processBounceEmail(bounceEmail: Email): Promise<BounceRecord | null>;
|
|
101
|
+
/**
|
|
102
|
+
* Handle a hard bounce by adding to suppression list
|
|
103
|
+
* @param bounce The bounce record
|
|
104
|
+
*/
|
|
105
|
+
private handleHardBounce;
|
|
106
|
+
/**
|
|
107
|
+
* Handle a soft bounce by scheduling a retry if eligible
|
|
108
|
+
* @param bounce The bounce record
|
|
109
|
+
*/
|
|
110
|
+
private handleSoftBounce;
|
|
111
|
+
/**
|
|
112
|
+
* Add an email address to the suppression list
|
|
113
|
+
* @param email Email address to suppress
|
|
114
|
+
* @param reason Reason for suppression
|
|
115
|
+
* @param expiresAt Expiration timestamp (undefined for permanent)
|
|
116
|
+
*/
|
|
117
|
+
addToSuppressionList(email: string, reason: string, expiresAt?: number): void;
|
|
118
|
+
/**
|
|
119
|
+
* Remove an email address from the suppression list
|
|
120
|
+
* @param email Email address to remove
|
|
121
|
+
*/
|
|
122
|
+
removeFromSuppressionList(email: string): void;
|
|
123
|
+
/**
|
|
124
|
+
* Check if an email is on the suppression list
|
|
125
|
+
* @param email Email address to check
|
|
126
|
+
* @returns Whether the email is suppressed
|
|
127
|
+
*/
|
|
128
|
+
isEmailSuppressed(email: string): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Get suppression information for an email
|
|
131
|
+
* @param email Email address to check
|
|
132
|
+
* @returns Suppression information or null if not suppressed
|
|
133
|
+
*/
|
|
134
|
+
getSuppressionInfo(email: string): {
|
|
135
|
+
reason: string;
|
|
136
|
+
timestamp: number;
|
|
137
|
+
expiresAt?: number;
|
|
138
|
+
} | null;
|
|
139
|
+
/**
|
|
140
|
+
* Save suppression list to disk
|
|
141
|
+
*/
|
|
142
|
+
private saveSuppressionList;
|
|
143
|
+
/**
|
|
144
|
+
* Load suppression list from disk
|
|
145
|
+
*/
|
|
146
|
+
private loadSuppressionList;
|
|
147
|
+
/**
|
|
148
|
+
* Save bounce record to disk
|
|
149
|
+
* @param bounce Bounce record to save
|
|
150
|
+
*/
|
|
151
|
+
private saveBounceRecord;
|
|
152
|
+
/**
|
|
153
|
+
* Update bounce cache with new bounce information
|
|
154
|
+
* @param bounce Bounce record to update cache with
|
|
155
|
+
*/
|
|
156
|
+
private updateBounceCache;
|
|
157
|
+
/**
|
|
158
|
+
* Check bounce history for an email address
|
|
159
|
+
* @param email Email address to check
|
|
160
|
+
* @returns Bounce information or null if no bounces
|
|
161
|
+
*/
|
|
162
|
+
getBounceInfo(email: string): {
|
|
163
|
+
lastBounce: number;
|
|
164
|
+
count: number;
|
|
165
|
+
type: BounceType;
|
|
166
|
+
category: BounceCategory;
|
|
167
|
+
} | null;
|
|
168
|
+
/**
|
|
169
|
+
* Get all known hard bounced addresses
|
|
170
|
+
* @returns Array of hard bounced email addresses
|
|
171
|
+
*/
|
|
172
|
+
getHardBouncedAddresses(): string[];
|
|
173
|
+
/**
|
|
174
|
+
* Get suppression list
|
|
175
|
+
* @returns Array of suppressed email addresses
|
|
176
|
+
*/
|
|
177
|
+
getSuppressionList(): string[];
|
|
178
|
+
/**
|
|
179
|
+
* Clear old bounce records (for maintenance)
|
|
180
|
+
* @param olderThan Timestamp to remove records older than
|
|
181
|
+
* @returns Number of records removed
|
|
182
|
+
*/
|
|
183
|
+
clearOldBounceRecords(olderThan: number): number;
|
|
184
|
+
}
|
|
185
|
+
export {};
|