dbpath = /etc/postfix/private/mail.sqlite query = SELECT coalesce(VM.home, 'vmail/%d/%u') FROM VMailbox AS VM JOIN Address AS A1 ON VM.id=A1.id JOIN Domain AS D1 ON A1.domain=D1.id WHERE A1.localpart || '@' || D1.name IS '%s' AND VM.active!=0 result_format = %s/Mail/ # This is for the virtual_mailbox_maps lookup, which returns the path # (relative to virtual_mailbox_base) to a virtual mailbox. It takes # either the VMailbox.home value or a default constructed with "vmail" # as the top directory component followed by the input domain name and # the localpart, each lowercased. # The VMailbox.id refers to an Address record, so we JOIN Address. We # get the localpart string value there, and JOIN Domain to get the # Domain.name string value. # The result is actually the virtual user's $HOME directory, so we # append "/Mail/" to that for the maildir's location. # Note, with virtual_mailbox_base of /home, any values of VMailbox.home # must be under /home, and the virtual_{u,g}id_maps user or group must # have the necessary rwx permission to enter, read & write the maildir. # The appendage of "/Mail/" is an inconvenience when delivering virtual # mail to a local user; it means that the local user must either receive # the mail in his/her regular inbox, or else make a symlink to an IMAP # folder name under ~/Mail/.