diff --git a/config.inc.php.dist b/config.inc.php.dist index 9ea52bf..43b43e2 100644 --- a/config.inc.php.dist +++ b/config.inc.php.dist @@ -14,6 +14,7 @@ /* * Preconfigured settings for different mail domains. * Appropriate set of values is searched by mapping domain of email (from identity) to array key. + * Use '*' as a wildcard to match any domain not explicitly listed. */ $config['ident_switch.preconfig'] = [ @@ -49,6 +50,13 @@ $config['ident_switch.preconfig'] = [ 'smtp_host' => 'tls://mail.another.tld:587', 'user' => 'mbox', ], + + // Wildcard: default settings for any domain not listed above. + // '*' => [ + // 'imap_host' => 'ssl://mail.example.com:993', + // 'smtp_host' => 'tls://mail.example.com:587', + // 'user' => 'email', + // ], ]; /* diff --git a/lib/IdentSwitchPreconfig.php b/lib/IdentSwitchPreconfig.php index 751c8c1..cf439f9 100644 --- a/lib/IdentSwitchPreconfig.php +++ b/lib/IdentSwitchPreconfig.php @@ -38,7 +38,7 @@ class IdentSwitchPreconfig $this->plugin->load_config(); $cfg = rcmail::get_instance()->config->get('ident_switch.preconfig', []); - $cfg = $cfg[$dom] ?? null; + $cfg = $cfg[$dom] ?? $cfg['*'] ?? null; if ($cfg) { if (empty($cfg['imap_host']) && empty($cfg['host'])) {