From b896551162b93b6e2b16f115b1803b15a8b2cde8 Mon Sep 17 00:00:00 2001 From: Willem Leuverink Date: Tue, 16 Apr 2024 10:56:16 +0200 Subject: [PATCH] update supervisor --- app/Livewire/Concerns/SmtpSupervisor.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Concerns/SmtpSupervisor.php b/app/Livewire/Concerns/SmtpSupervisor.php index e4155f2..3dd8a91 100644 --- a/app/Livewire/Concerns/SmtpSupervisor.php +++ b/app/Livewire/Concerns/SmtpSupervisor.php @@ -8,10 +8,13 @@ use App\Services\Smtp\Server; use App\Events\MessageReceived; use Livewire\Attributes\Renderless; +use Native\Laravel\Facades\Notification; +use ZBateson\MailMimeParser\Header\HeaderConsts; trait SmtpSupervisor { const PORT = 2525; + const NOTIFICATION_TITLE = "You've got Phost!"; /** * Called with wire:poll to keep the server alive. @@ -26,9 +29,13 @@ function () { Server::new(self::PORT) ->onMessageReceived(function ($content) { - MessageReceived::dispatch( - Message::fromContent($content) - ); + $message = Message::fromContent($content); + + Notification::title(self::NOTIFICATION_TITLE) + ->message($message->parsed->getHeaderValue(HeaderConsts::SUBJECT)) + ->show(); + + MessageReceived::dispatch($message); })->serve(); },