Files
fewo-stommer/app/Mail/PortalMailNotification.php
T
Lars StommerandClaude Opus 5.5 e5f9e0762f Schnellerkennung von Portalbuchungen per E-Mail
- IMAP-Abruf jede Minute (webklex/php-imap, ohne PHP-imap-Erweiterung) oder signierter Push von n8n
- Parser für Buchungs-, Storno- und Anfrage-Mails (de/en), Buchungsnummer, An-/Abreise
- Erkannte Buchungen werden sofort gesperrt und an handgepflegte Portale weitergegeben; Kalender-Abgleich übernimmt bzw. ersetzt Mail-Sperren
- Unklare Mails: Prüf-Mail + Admin-Liste Portal-E-Mails mit Aktion Sperre anlegen
- Überwachung des Postfachs in Monitor und /health/sync

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:29:26 +02:00

42 lines
1.1 KiB
PHP

<?php
namespace App\Mail;
use App\Enums\PortalEmailStatus;
use App\Models\PortalEmail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
/**
* Tells the landlord what was done with a portal notification e-mail.
*/
class PortalMailNotification extends Mailable
{
use Queueable, SerializesModels;
public function __construct(public PortalEmail $portalEmail) {}
public function envelope(): Envelope
{
$channel = $this->portalEmail->channel->name;
return new Envelope(
subject: match ($this->portalEmail->status) {
PortalEmailStatus::Blocked => "{$channel}-Buchung erkannt und gesperrt: {$this->portalEmail->period()}",
PortalEmailStatus::Released => "{$channel}-Stornierung: {$this->portalEmail->period()} wieder frei",
default => "Bitte prüfen: E-Mail von {$channel}",
},
);
}
public function content(): Content
{
return new Content(
markdown: 'mail.portal-mail',
);
}
}