fix(mail): align queue, outbound hostname, and DKIM selector behavior across the mail server APIs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as plugins from '../../plugins.js';
|
||||
import * as paths from '../../paths.js';
|
||||
import { logger } from '../../logger.js';
|
||||
import { hasStorageManagerMethods, type IStorageManagerLike } from '../interfaces.storage.js';
|
||||
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.js';
|
||||
import { RustSecurityBridge } from '../../security/classes.rustsecuritybridge.js';
|
||||
import { LRUCache } from 'lru-cache';
|
||||
@@ -107,13 +108,13 @@ export class BounceManager {
|
||||
expiresAt?: number; // undefined means permanent
|
||||
}> = new Map();
|
||||
|
||||
private storageManager?: any; // StorageManager instance
|
||||
private storageManager?: IStorageManagerLike;
|
||||
|
||||
constructor(options?: {
|
||||
retryStrategy?: Partial<RetryStrategy>;
|
||||
maxCacheSize?: number;
|
||||
cacheTTL?: number;
|
||||
storageManager?: any;
|
||||
storageManager?: IStorageManagerLike;
|
||||
}) {
|
||||
// Set retry strategy with defaults
|
||||
if (options?.retryStrategy) {
|
||||
@@ -552,7 +553,7 @@ export class BounceManager {
|
||||
try {
|
||||
const suppressionData = JSON.stringify(Array.from(this.suppressionList.entries()));
|
||||
|
||||
if (this.storageManager) {
|
||||
if (hasStorageManagerMethods(this.storageManager, ['set'])) {
|
||||
// Use storage manager
|
||||
await this.storageManager.set('/email/bounces/suppression-list.json', suppressionData);
|
||||
} else {
|
||||
@@ -574,7 +575,7 @@ export class BounceManager {
|
||||
let entries = null;
|
||||
let needsMigration = false;
|
||||
|
||||
if (this.storageManager) {
|
||||
if (hasStorageManagerMethods(this.storageManager, ['get'])) {
|
||||
// Try to load from storage manager first
|
||||
const suppressionData = await this.storageManager.get('/email/bounces/suppression-list.json');
|
||||
|
||||
@@ -636,7 +637,7 @@ export class BounceManager {
|
||||
try {
|
||||
const bounceData = JSON.stringify(bounce, null, 2);
|
||||
|
||||
if (this.storageManager) {
|
||||
if (hasStorageManagerMethods(this.storageManager, ['set'])) {
|
||||
// Use storage manager
|
||||
await this.storageManager.set(`/email/bounces/records/${bounce.id}.json`, bounceData);
|
||||
} else {
|
||||
@@ -750,4 +751,4 @@ export class BounceManager {
|
||||
this.cleanupInterval = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user