user_query = SELECT maildir, 1001 AS uid, 1001 AS gid FROM mailbox WHERE username = '%u' AND active='1'
NB! The GID and UID are for postfix user and group ID, NOT MySQL user and group ID.
3. Dovecot v1.0 quota support (optional)
----------------------------------------
Please note that you need to use Dovecot's own local delivery agent to
enforce and update quotas. Then you can view real-time used quotas in
Postfixadmin.
Add to dovecot.conf:
## IMAP quota
protocol imap {
quota = dict:storage=200000 proxy::quota
}
## POP quota
protocol pop3 {
mail_plugins = quota
}
## Local Delivery Agent
protocol lda {
mail_plugins = quota
}
## Dictionary DB proxy
dict {
quota = mysql:/etc/dovecot-dict-quota.conf
}
## Default quota values
plugin {
quota = dict:storage=200000 proxy::quota
}
Change dovecot-mysql.conf to return quota values:
user_query = SELECT maildir, 1001 AS uid, 1001 AS gid, CONCAT('dict:storage=',floor(quota/1000),' proxy::quota') as quota FROM mailbox WHERE username = '%u'