On Sep 3, 2025, at 20:25, Zhang Huangbin <zhb@iredmail.org> wrote:
I'm migrating from Dovecot 2.3 to 2.4 on Debian 13, only one issue remains: How can i override global mail_driver, mail_path, mail_index_path parameters with a SQL userdb?
mail_driver = maildir mail_path = ~/Maildir mail_index_path = ~/Maildir
userdb sql { query = SELECT ..., LOWER(mailbox.mailboxformat) AS mail_driver,
CONCAT("~/", mailbox.mailboxfolder) AS mail_path,
CONCAT(LOWER(mailbox.mailboxformat), ":~/", mailbox.mailboxfolder) AS mail,
CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule
FROM mailbox,domain
WHERE ... }
ok, find the answer in Settings Variables[1] and Passwd-file[2] page. Here's the working setting:
mail_driver = %{userdb:mail_driver | default("maildir") | lower} mail_path = %{userdb:mail_path | default("~/Maildir")}
userdb returns mail_driver
and mail_path
.
[1] https://doc.dovecot.org/2.4.1/core/settings/variables.html [2] https://doc.dovecot.org/2.4.1/core/config/auth/databases/passwd_file.html