Source

iredmail / iRedMail / samples / dovecot / dovecot-pgsql-8.x.conf

driver = pgsql
default_pass_scheme = CRYPT
connect = host=PH_SQL_SERVER dbname=PH_VMAIL_DB user=PH_VMAIL_DB_BIND_USER password=PH_VMAIL_DB_BIND_PASSWD
password_query = SELECT password FROM mailbox WHERE username='%u' AND active='1'
user_query = SELECT \
    mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \
    '*:bytes=' || mailbox.quota*1048576 AS quota_rule \
FROM mailbox,domain \
WHERE mailbox.username='%u' \
    AND mailbox.domain='%d' \
    AND mailbox.enable%Ls%Lc=1 \
    AND mailbox.domain=domain.domain \
    AND domain.backupmx=0 \
    AND domain.active=1 \
    AND mailbox.active=1