diff --git a/app/Support/MailSettings.php b/app/Support/MailSettings.php index 74c5f31..79e3bdb 100644 --- a/app/Support/MailSettings.php +++ b/app/Support/MailSettings.php @@ -90,12 +90,12 @@ final class MailSettings $mail = Setting::where('key', 'smtp')->first(); $setting = Setting::where('key', 'setting')->first(); - if (!$mail || !$setting) { + $mail = $mail ? json_decode((string) $mail->value) : null; + if (!is_object($mail)) { return null; } - $mail = json_decode($mail->value); - $company = json_decode($setting->value)->company ?? 'Your Company'; + $company = ($setting ? json_decode((string) $setting->value)->company ?? null : null) ?: config('mail.from.name'); $password = ''; if (isset($mail->password)) { diff --git a/public/.DS_Store b/public/.DS_Store index bd21257..0d4d9a6 100644 Binary files a/public/.DS_Store and b/public/.DS_Store differ diff --git a/storage/.DS_Store b/storage/.DS_Store index b698e70..5e7f36f 100644 Binary files a/storage/.DS_Store and b/storage/.DS_Store differ diff --git a/storage/app/.~whmcs-mapping.xlsx b/storage/app/.~whmcs-mapping.xlsx new file mode 100644 index 0000000..e447015 Binary files /dev/null and b/storage/app/.~whmcs-mapping.xlsx differ diff --git a/storage/app/whmcs-mapping-20261021-161552.xlsx b/storage/app/whmcs-mapping-20261021-161552.xlsx new file mode 100644 index 0000000..306d023 Binary files /dev/null and b/storage/app/whmcs-mapping-20261021-161552.xlsx differ diff --git a/storage/app/whmcs-mapping.xlsx b/storage/app/whmcs-mapping.xlsx new file mode 100644 index 0000000..306d023 Binary files /dev/null and b/storage/app/whmcs-mapping.xlsx differ diff --git a/tests/Feature/Mail/MailSettingsQueueTest.php b/tests/Feature/Mail/MailSettingsQueueTest.php index 336a8e8..88553b9 100644 --- a/tests/Feature/Mail/MailSettingsQueueTest.php +++ b/tests/Feature/Mail/MailSettingsQueueTest.php @@ -49,6 +49,18 @@ class MailSettingsQueueTest extends TestCase $this->assertSame('smtp.settings-two.test', $this->hostSeenByQueuedJob()); } + public function test_smtp_settings_apply_without_general_setting_row(): void + { + $this->saveSmtp('smtp.settings-only.test'); + Setting::where('key', 'setting')->delete(); + Cache::forget(MailSettings::cacheKey()); + + MailSettings::apply(); + + $this->assertSame('smtp.settings-only.test', config('mail.mailers.smtp.host')); + $this->assertSame('TGS', config('mail.from.name')); + } + public function test_system_cc_and_bcc_are_applied_without_duplicate_recipients(): void { $this->saveSmtp('smtp.settings.test');