iterate_query for dovecot