mail: zentrale Bounce-Suppression mit Versand-Gate und Circuit Breaker (Roadmap 1b.6, Schritte 1–2)

email_suppressions/email_bounces als Zustand und Ereignis-Log; ein
MessageSending-Listener streicht gesperrte Empfänger aus JEDER ausgehenden
Mail und setzt den Return-Path. Zweiter Aufnahmepfad: SMTP-Ablehnungen im
Worker — 5.1.x sperrt den Empfänger, Relay-Ablehnungen zählen für den
Circuit Breaker, der den Versand anhält statt gesunde Adressen zu sperren.
X-Pk-Ref-Header auf den Mails, API-Meldungen fallen auf die Firmen-E-Mail
zurück, der Bounce-Import schreibt in die zentrale Liste.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-15 13:48:56 +00:00
parent 87f95fb7a7
commit 0a658bb34b
25 changed files with 1312 additions and 4 deletions

View file

@ -28,6 +28,7 @@ enum ActivityType: string
case Anonymization = 'anonymization';
case Correction = 'correction';
case ContentRemoval = 'content_removal';
case MailSuppressed = 'mail_suppressed';
public function label(): string
{
@ -51,6 +52,7 @@ enum ActivityType: string
self::Anonymization => 'Anonymisierung',
self::Correction => 'Korrektur',
self::ContentRemoval => 'Entfernung (410)',
self::MailSuppressed => 'Mail-Sperre',
};
}
@ -74,6 +76,7 @@ enum ActivityType: string
self::Anonymization => 'red',
self::Correction => 'blue',
self::ContentRemoval => 'red',
self::MailSuppressed => 'orange',
};
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace App\Enums;
/**
* Art eines Rückläufers. Maßgeblich ist bei DSNs `Action`, nicht der
* Statuscode allein (Konzept `bounce-mails-2026-09-15.md`).
*/
enum EmailBounceKind: string
{
/** `Action: failed`, Status 5.x.x — Postfach existiert nicht, sofort sperren */
case Hard = 'hard';
/** `Action: delayed` oder Status 4.x.x — zählen, ab dem dritten in sieben Tagen sperren */
case Soft = 'soft';
/** Relay lehnt UNS ab (5.7.x, 554 Spam-Pattern, Verbindung) — kein Empfängerproblem, Circuit Breaker */
case Relay = 'relay';
public function label(): string
{
return match ($this) {
self::Hard => 'hart',
self::Soft => 'weich',
self::Relay => 'Relay',
};
}
}

View file

@ -0,0 +1,21 @@
<?php
namespace App\Enums;
enum EmailSuppressionReason: string
{
case HardBounce = 'hard_bounce';
case SoftBounces = 'soft_bounces';
case Manual = 'manual';
public function label(): string
{
return match ($this) {
self::HardBounce => 'Postfach existiert nicht',
self::SoftBounces => 'wiederholt unzustellbar',
self::Manual => 'manuell gesperrt',
};
}
}