Posteingang: Antwortbezug ohne Klammern, Testadresse im Testbetrieb, sofortige Auswertung
Deploy FeWo mit PipelineManager / deploy (push) Successful in 5m6s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 5m6s
- Antwortbezug (In-Reply-To/References) wird mit und ohne spitze Klammern verglichen – Strato liefert ihn ohne, gespeichert war er mit; Antworten blieben deshalb im Posteingang hängen. - Testbetrieb: Die Testadresse steht zusammen mit der genannten Vorgangsnummer für den Gast dieses Vorgangs (alle Antworten kommen vom Testpostfach). Im Live-Betrieb gilt das nicht. - Eine zugeordnete Nachricht wird sofort ausgewertet (automatisch und nach Zuordnung von Hand), nicht erst im Fünf-Minuten-Lauf; die Meldung nennt, was übernommen wurde. Neu: „Erneut auswerten“. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f4a435c71a
commit
ad63db78f3
6 files changed
+78
-11
No files matched your search
@@ -7,6 +7,7 @@
|
||||
use App\Models\BookingMessage;
|
||||
use App\Models\InboundMessage;
|
||||
use App\Models\Property;
|
||||
use App\Support\Settings;
|
||||
use Carbon\CarbonImmutable;
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,9 @@ public function match(InboundMessage $message): array
|
||||
$sender = mb_strtolower(trim((string) $message->from_address));
|
||||
$text = $message->subject."\n".$message->body;
|
||||
|
||||
$references = array_values(array_filter([$message->in_reply_to, ...((array) $message->references)]));
|
||||
// Message-IDs are compared with and without angle brackets (mail servers deliver both forms).
|
||||
$references = collect([$message->in_reply_to, ...((array) $message->references)])->filter()
|
||||
->flatMap(fn (string $id): array => ['<'.trim($id, '<> ').'>', trim($id, '<> ')])->unique()->values()->all();
|
||||
if ($references !== []) {
|
||||
$replied = BookingMessage::query()->whereIn('message_id', $references)->whereNotNull('booking_id')->latest('id')->first()?->booking;
|
||||
if ($replied !== null) {
|
||||
@@ -39,8 +42,13 @@ public function match(InboundMessage $message): array
|
||||
}
|
||||
|
||||
$hints = [];
|
||||
// In test operation every answer comes from the test mailbox: there it stands for the guest of the named case.
|
||||
$testSender = $message->test_mode && $sender !== '' && $sender === mb_strtolower(trim((string) Settings::tenant()?->test_recipient));
|
||||
if (preg_match_all('/\b(20\d{2}-\d{4})\b/', $text, $numbers)) {
|
||||
foreach (Booking::query()->whereIn('reference', array_unique($numbers[1]))->with('guest')->get() as $booking) {
|
||||
if ($testSender) {
|
||||
return ['booking' => $booking, 'reason' => 'reference_test_sender', 'hints' => []];
|
||||
}
|
||||
if ($sender !== '' && mb_strtolower((string) $booking->guest?->email) === $sender) {
|
||||
return ['booking' => $booking, 'reason' => 'reference_and_sender', 'hints' => []];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user