From 742c39f91ae75a00cbe3886470eed697d26b807b Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 26 Apr 2026 23:53:05 +0200 Subject: [PATCH] Fix: BASE_DOMAIN wird beim Speichern der Domains aus mail_domain abgeleitet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit War auf Live-Server noch 'example.com' weshalb sysmail nie angelegt wurde. mx.pxo.at → BASE_DOMAIN=pxo.at, MTA_SUB=mx automatisch gesetzt. Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Ui/System/SettingsForm.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/Livewire/Ui/System/SettingsForm.php b/app/Livewire/Ui/System/SettingsForm.php index 9e7e201..72575ec 100644 --- a/app/Livewire/Ui/System/SettingsForm.php +++ b/app/Livewire/Ui/System/SettingsForm.php @@ -445,24 +445,38 @@ class SettingsForm extends Component private function syncDomainsToEnv(): void { - $base = rtrim((string) config('mailwolt.domain.base', ''), '.'); + // BASE_DOMAIN aus mail_domain ableiten (mx.pxo.at → pxo.at) + $derivedBase = ''; + if ($this->mail_domain) { + $parts = explode('.', strtolower(trim($this->mail_domain))); + $derivedBase = count($parts) > 2 + ? implode('.', array_slice($parts, 1)) + : implode('.', $parts); + } + + $base = $derivedBase ?: rtrim((string) config('mailwolt.domain.base', ''), '.'); $sub = function (string $full) use ($base): string { $full = strtolower(trim($full)); if ($base && str_ends_with($full, '.' . $base)) { return substr($full, 0, -(strlen($base) + 1)); } - // Kein passender Base — ersten Label nehmen $parts = explode('.', $full); return count($parts) > 1 ? $parts[0] : ''; }; - $this->writeEnv([ + $env = [ 'WEBMAIL_SUB' => $this->webmail_domain ? $sub($this->webmail_domain) : '', 'WEBMAIL_DOMAIN' => $this->webmail_domain ?: '', 'UI_SUB' => $this->ui_domain ? $sub($this->ui_domain) : '', 'MTA_SUB' => $this->mail_domain ? $sub($this->mail_domain) : '', - ]); + ]; + + if ($derivedBase && $derivedBase !== 'example.com') { + $env['BASE_DOMAIN'] = $derivedBase; + } + + $this->writeEnv($env); Artisan::call('config:clear'); Artisan::call('route:clear');