Symptoms
After clearing messages from an email account using mdbox, the disk usage within /home/user/mail/domain.tld/account/ still is used.
Description
This behavior is caused by how Dovecot stores and processes messages with the mdbox storage system. The email messages are stored in databases within the user's home directory. When messages are removed, Dovecot unlinks them in the database, but the data is still stored on the disk. Normally this is automatically triggered on IMAP activity, but it can be manually forced.
Workaround
The doveadm utility can be used to clear the stored data. The purge function will remove the emails from the database that are no longer referenced in the index. An example of this command is the following run as the root user:
doveadm purge -u account@domain.tld
Additional documentation from Dovecot can be found here:
https://wiki.dovecot.org/Tools/Doveadm/Purge