dovecot2でMySQLを使って認証する設定例

driver = mysql
default_pass_scheme = SHA512
connect = host=127.0.0.1 dbname=dbname user=dbuser password=XXXXXXX
password_query = SELECT username, domain, password FROM user WHERE userid = '%n' AND domain = '%d'
user_query = SELECT '/var/mail/%d/%n' AS home, 'mail' AS uid, 'mail' AS _gid FROM user WHERE username = '%n' AND domain = '%d' AND IMAP_allowed = 'YES'