find($this->inquiryId); if ($inquiry === null) { return; } $recipients = CommunicationSettings::current()->recipientList(); if ($recipients === []) { $inquiry->forceFill(['notification_error' => 'Es sind keine Empfänger für Benachrichtigungen hinterlegt (Kommunikation → Einstellungen).'])->save(); return; } try { Mail::to($recipients)->send(new InquiryReceived($inquiry)); } catch (Throwable $e) { report($e); $inquiry->forceFill(['notification_error' => 'Der E-Mail-Versand ist fehlgeschlagen: '.Str::limit($e->getMessage(), 400)])->save(); return; } $inquiry->forceFill(['notified_at' => now(), 'notification_error' => null])->save(); } }