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 fromAddrFinal = fromAddr;
|
||||
let isBounce = false;
|
||||
let parsedFinal: ParsedMail | null = null; // <-- Hier deklarieren
|
||||
|
||||
try {
|
||||
const parsed = await parseEmail(rawBytes);
|
||||
|
|
@ -147,7 +148,6 @@ export class MessageProcessor {
|
|||
subject,
|
||||
workerName,
|
||||
);
|
||||
|
||||
isBounce = bounceResult.isBounce;
|
||||
finalRawBytes = bounceResult.rawBytes;
|
||||
|
||||
|
|
@ -165,17 +165,17 @@ export class MessageProcessor {
|
|||
}
|
||||
|
||||
// Re-parse after modifications for rules processing
|
||||
var parsedFinal = await parseEmail(finalRawBytes);
|
||||
parsedFinal = await parseEmail(finalRawBytes);
|
||||
} catch (err: any) {
|
||||
log(
|
||||
`⚠ Parsing/Logic Error: ${err.message ?? err}. Sending original.`,
|
||||
`⚠ Parsing/Logic Error: ${err.message ?? err}. Sending original RAW mail without rules.`,
|
||||
'WARNING',
|
||||
workerName,
|
||||
);
|
||||
log(`Full error: ${err.stack ?? err}`, 'ERROR', workerName);
|
||||
fromAddrFinal = fromAddr;
|
||||
isBounce = false;
|
||||
var parsedFinal = await parseEmail(rawBytes);
|
||||
parsedFinal = null; // <-- GANZ WICHTIG: Kein erneuter Parse-Versuch!
|
||||
}
|
||||
|
||||
// 6. BLOCKLIST CHECK
|
||||
|
|
@ -215,7 +215,7 @@ export class MessageProcessor {
|
|||
}
|
||||
|
||||
// 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) => {
|
||||
if (action === 'autoreply') this.metrics?.incrementAutoreply(dom);
|
||||
else if (action === 'forward') this.metrics?.incrementForward(dom);
|
||||
|
|
|
|||
Loading…
Reference in New Issue