If you log into cPanel and notice that the disk space usage for an email account is incorrect as compared to what is computed via SSH, it may be because maildir is not updating.
To test, log into SSH, and try to trigger the maildirsize file to be regenerated. To do this for the default email account, run the following:
mv /home/cpaneluser/mail/maildirsize /home/cpaneluser/mail/maildirsize.bak
To do this for any other non-default account, run this (substituting the account name 'emailaccount' for the account whose maildirsize file is being regenerated):
mv /home/cpaneluser/mail/domain.com/emailaccount/maildirsize /home/cpaneluser/mail/domain.com/emailaccount/maildirsize.bak
For example, you would run this command for firstname.lastname@example.org owned by cPanel user myunique:
mv /home/myunique/mail/myuniquedomain.tld/support/maildirsize /home/myunique/mail/myuniquedomain.tld/support/maildirsize.bak
Log back into cPanel and visit the Email Accounts section to determine whether the cached email account's disk space usage is shown, or if it is showing an updated calculation.
If the cached information is still shown, you can run the following command to forcefully regenerate the maildir file:
/scripts/generate_maildirsize --confirm --allaccounts --verbose cpaneluser
You should see output like the following:
Checking user email@example.com Calculating diskusage and diskcount from reading files Writing /home/cpaneluser/mail/domain.com/emailaccount/maildirsize for user cpaneluser
You could try running the following command to recalculate this as well, which appears to the same command ran by the cPanel script noted above:
/usr/bin/doveadm quota recalc -u firstname.lastname@example.org
You should now be able to log into cPanel and have it show the correct disk space usage for the account(s).