Just checked the Variables documentation http://wiki2.dovecot.org/Variables, which says: %D - return "sub.domain.org" as "sub,dc=domain,dc=org" (for LDAP queries) so it seems* you should be able to use "base = %D" [*] assuming the wiki meant to say "dc=sub,dc=domain,dc=org" -jf