feat(structure): Use unified Email class

This commit is contained in:
2025-05-27 15:38:34 +00:00
parent cfea44742a
commit 243a45d24c
11 changed files with 546 additions and 143 deletions

View File

@ -3,6 +3,7 @@ import * as paths from '../../paths.js';
import { logger } from '../../logger.js';
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.js';
import { LRUCache } from 'lru-cache';
import type { Email } from './classes.email.js';
/**
* Bounce types for categorizing the reasons for bounces
@ -380,7 +381,7 @@ export class BounceManager {
* @param bounceEmail The email containing bounce information
* @returns Processed bounce record or null if not a bounce
*/
public async processBounceEmail(bounceEmail: plugins.smartmail.Smartmail<any>): Promise<BounceRecord | null> {
public async processBounceEmail(bounceEmail: Email): Promise<BounceRecord | null> {
try {
// Check if this is a bounce notification
const subject = bounceEmail.getSubject();
@ -435,7 +436,7 @@ export class BounceManager {
if (!recipient) {
logger.log('warn', 'Could not extract recipient from bounce notification', {
subject,
sender: bounceEmail.options.from
sender: bounceEmail.from
});
return null;
}
@ -449,7 +450,7 @@ export class BounceManager {
// Create bounce data
const bounceData: Partial<BounceRecord> = {
recipient,
sender: bounceEmail.options.from,
sender: bounceEmail.from,
domain: recipient.split('@')[1],
subject: bounceEmail.getSubject(),
diagnosticCode,