Source

iredmail / iRedMail / samples / conf / dovecot2-mysql.conf

driver = mysql
default_pass_scheme = CRYPT
connect = host=PH_MYSQL_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 \
    CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
    CONCAT('*: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