Feat: SystemDomainSeeder wird bei saveDomains ausgeführt wenn sysmail fehlt

Beim Speichern der Server-Domains in den Einstellungen wird automatisch die
sysmail-Domain (sysmail.<BASE_DOMAIN>) 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 <noreply@anthropic.com>
main v1.1.364
boban 2026-04-26 23:20:44 +02:00
parent 8ff63dd966
commit 96477ede1c
2 changed files with 18 additions and 1 deletions

View File

@ -199,6 +199,23 @@ class SettingsForm extends Component
$this->applyDomains(false);
}
// System-Domain (sysmail.<BASE_DOMAIN>) 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',

View File

@ -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,