send mail even if if parsing fails
This commit is contained in:
parent
d9a91c13ed
commit
99ab2a07d8
|
|
@ -135,6 +135,7 @@ export class MessageProcessor {
|
||||||
let finalRawBytes = rawBytes;
|
let finalRawBytes = rawBytes;
|
||||||
let fromAddrFinal = fromAddr;
|
let fromAddrFinal = fromAddr;
|
||||||
let isBounce = false;
|
let isBounce = false;
|
||||||
|
let parsedFinal: ParsedMail | null = null; // <-- Hier deklarieren
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsed = await parseEmail(rawBytes);
|
const parsed = await parseEmail(rawBytes);
|
||||||
|
|
@ -147,7 +148,6 @@ export class MessageProcessor {
|
||||||
subject,
|
subject,
|
||||||
workerName,
|
workerName,
|
||||||
);
|
);
|
||||||
|
|
||||||
isBounce = bounceResult.isBounce;
|
isBounce = bounceResult.isBounce;
|
||||||
finalRawBytes = bounceResult.rawBytes;
|
finalRawBytes = bounceResult.rawBytes;
|
||||||
|
|
||||||
|
|
@ -165,17 +165,17 @@ export class MessageProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-parse after modifications for rules processing
|
// Re-parse after modifications for rules processing
|
||||||
var parsedFinal = await parseEmail(finalRawBytes);
|
parsedFinal = await parseEmail(finalRawBytes);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
log(
|
log(
|
||||||
`⚠ Parsing/Logic Error: ${err.message ?? err}. Sending original.`,
|
`⚠ Parsing/Logic Error: ${err.message ?? err}. Sending original RAW mail without rules.`,
|
||||||
'WARNING',
|
'WARNING',
|
||||||
workerName,
|
workerName,
|
||||||
);
|
);
|
||||||
log(`Full error: ${err.stack ?? err}`, 'ERROR', workerName);
|
log(`Full error: ${err.stack ?? err}`, 'ERROR', workerName);
|
||||||
fromAddrFinal = fromAddr;
|
fromAddrFinal = fromAddr;
|
||||||
isBounce = false;
|
isBounce = false;
|
||||||
var parsedFinal = await parseEmail(rawBytes);
|
parsedFinal = null; // <-- GANZ WICHTIG: Kein erneuter Parse-Versuch!
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. BLOCKLIST CHECK
|
// 6. BLOCKLIST CHECK
|
||||||
|
|
@ -215,7 +215,7 @@ export class MessageProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process rules (OOO, Forwarding) — not for bounces or already forwarded
|
// Process rules (OOO, Forwarding) — not for bounces or already forwarded
|
||||||
if (!isBounce && !skipRules) {
|
if (!isBounce && !skipRules && parsedFinal !== null) {
|
||||||
const metricsCallback = (action: 'autoreply' | 'forward', dom: string) => {
|
const metricsCallback = (action: 'autoreply' | 'forward', dom: string) => {
|
||||||
if (action === 'autoreply') this.metrics?.incrementAutoreply(dom);
|
if (action === 'autoreply') this.metrics?.incrementAutoreply(dom);
|
||||||
else if (action === 'forward') this.metrics?.incrementForward(dom);
|
else if (action === 'forward') this.metrics?.incrementForward(dom);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue