From 96477ede1c535a908bf8922d3844e8c12b00a840 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Apr 2026 23:20:44 +0200 Subject: [PATCH] =?UTF-8?q?Feat:=20SystemDomainSeeder=20wird=20bei=20saveD?= =?UTF-8?q?omains=20ausgef=C3=BChrt=20wenn=20sysmail=20fehlt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Beim Speichern der Server-Domains in den Einstellungen wird automatisch die sysmail-Domain (sysmail.) mit DKIM, SPF, DMARC und no-reply Postfach angelegt, sofern sie noch nicht existiert. Seeder nutzt updateOrCreate für Postfach. Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Ui/System/SettingsForm.php | 17 +++++++++++++++++ database/seeders/SystemDomainSeeder.php | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Ui/System/SettingsForm.php b/app/Livewire/Ui/System/SettingsForm.php index 24ea737..def979c 100644 --- a/app/Livewire/Ui/System/SettingsForm.php +++ b/app/Livewire/Ui/System/SettingsForm.php @@ -199,6 +199,23 @@ class SettingsForm extends Component $this->applyDomains(false); } + // System-Domain (sysmail.) provisionieren, falls noch nicht vorhanden + $platformBase = config('mailpool.platform_zone', env('BASE_DOMAIN', '')); + if ($platformBase && $platformBase !== 'example.com') { + $systemSub = config('mailpool.platform_system_zone', 'sysmail'); + $systemFqdn = strtolower("{$systemSub}.{$platformBase}"); + if (!\App\Models\Domain::where('domain', $systemFqdn)->exists()) { + try { + Artisan::call('db:seed', [ + '--class' => 'Database\\Seeders\\SystemDomainSeeder', + '--force' => true, + ]); + } catch (\Throwable $e) { + \Illuminate\Support\Facades\Log::error('SystemDomainSeeder failed', ['error' => $e->getMessage()]); + } + } + } + $this->loadSslStatus(); $this->dispatch('toast', type: 'done', badge: 'Domains', diff --git a/database/seeders/SystemDomainSeeder.php b/database/seeders/SystemDomainSeeder.php index ea71369..c2166da 100644 --- a/database/seeders/SystemDomainSeeder.php +++ b/database/seeders/SystemDomainSeeder.php @@ -140,7 +140,7 @@ class SystemDomainSeeder extends Seeder $this->command->line("System-Domain angelegt: {$systemDomain->domain}"); } - $noReply = MailUser::firstOrCreate( + $noReply = MailUser::updateOrCreate( ['domain_id' => $systemDomain->id, 'localpart' => 'no-reply'], [ 'email' => 'no-reply@' . $systemDomain->domain,