Forward-Rule mit smtp_override → Mail geht nur zum alten Provider, keine DMS-Delivery

Forward-Rule ohne smtp_override → normaler Forward + DMS-Delivery (bestehendes Verhalten)
Keine Rule → nur DMS-Delivery (bestehendes Verhalten)
This commit is contained in:
Andreas Knuth 2026-02-10 11:57:10 -06:00
parent 994cf9055c
commit 3bd1ed14cf
2 changed files with 30 additions and 28 deletions

View File

@ -44,7 +44,7 @@ class RulesProcessor:
rule = self.dynamodb.get_email_rules(recipient)
if not rule:
return
return False # NEU: Return-Wert
original_from = parsed.get('From', '')
sender_name, sender_addr = parseaddr(original_from)
@ -69,17 +69,16 @@ class RulesProcessor:
# Forward handling
# ============================================
forwards = rule.get('forwards', [])
has_legacy_forward = False # NEU
if forwards:
if rule.get('forward_smtp_override'):
has_legacy_forward = True # NEU
self._handle_forwards(
recipient,
parsed,
original_from,
forwards,
domain,
worker_name,
metrics_callback,
rule=rule
recipient, parsed, original_from, forwards,
domain, worker_name, metrics_callback, rule=rule
)
return has_legacy_forward # NEU: statt kein Return
def _handle_ooo(
self,

View File

@ -184,6 +184,7 @@ class MessageProcessor:
continue
# Process rules (OOO, Forwarding) - not for bounces or already forwarded
skip_local_delivery = False # NEU
if not is_bounce and not skip_rules:
def metrics_callback(action_type: str, dom: str):
"""Callback for metrics from rules processor"""
@ -193,7 +194,7 @@ class MessageProcessor:
elif action_type == 'forward':
self.metrics.increment_forward(dom)
self.rules_processor.process_rules_for_recipient(
skip_local_delivery = self.rules_processor.process_rules_for_recipient(
recipient,
parsed,
domain,
@ -202,11 +203,13 @@ class MessageProcessor:
)
# SMTP Delivery
if skip_local_delivery: # NEU
log(f" ⏭ Skipping local delivery for {recipient} (legacy forward active)",
'INFO', worker_name)
successful.append(recipient) # Zählt als "handled"
else:
success, error, is_perm = self.delivery.send_to_recipient(
from_addr_final,
recipient,
raw_bytes,
worker_name
from_addr_final, recipient, raw_bytes, worker_name
)
if success: