Support separate IMAP and SMTP hosts in preconfig

The preconfig previously used a single 'host' field for both IMAP and
SMTP, making it impossible to configure different servers/schemes/ports
(e.g. IMAPS on 993 + SMTP STARTTLS on 587). Also, ssl:// scheme was
silently lost during parse_url() since only tls:// was recognized.

Add imap_host and smtp_host as separate config keys with full scheme
support (ssl://, tls://). The legacy 'host' key is still supported as
fallback for backward compatibility.
This commit is contained in:
Laurent Dinclaux
2026-02-10 10:56:45 +11:00
parent 16af27a3f4
commit 9ebe30c40a
2 changed files with 51 additions and 11 deletions

View File

@@ -20,9 +20,15 @@ $config['ident_switch.preconfig'] = [
// Domain part of email address
'domain.tld' => [
// Hostname, use ssl:// or tls:// notation if needed, for no security use imap:// (must always start with scheme).
// IMAP connection: scheme://host:port
// Schemes: ssl:// for IMAPS (port 993), tls:// for STARTTLS (port 143).
// Required.
'host' => 'imap://mail.domain.tld',
'imap_host' => 'ssl://mail.domain.tld:993',
// SMTP connection: scheme://host:port
// Schemes: tls:// for STARTTLS (port 587), ssl:// for SMTPS (port 465).
// Falls back to imap_host if not specified.
'smtp_host' => 'tls://mail.domain.tld:587',
// Login name, can be 'email' (full address from identity), 'mbox' (only mailbox part).
// Any other value is treated as 'not specified' (default).
@@ -34,7 +40,8 @@ $config['ident_switch.preconfig'] = [
],
'another.tld' => [
'host' => 'tls://mail.another.tld',
'imap_host' => 'tls://mail.another.tld:143',
'smtp_host' => 'tls://mail.another.tld:587',
'user' => 'mbox',
],
];