Symptoms
The mail usage for the email accounts in the "Email Accounts" section is not updated and is not accurate after removing emails from the accounts.
Description
The Email address shows an incorrect disk space, caused by the maildirsize file for the email accounts not having been updated yet.
Workaround
1. Move the maildirsize files out of the way as the below script will not overwrite the files.
NOTE: Be sure to replace CPUSER with the cPanel username of the account in question.
find /home/CPUSER/mail/ -type f -name maildirsize | while read line; do mv -v $line{,.bak}; done
2. Run the following script as root with the cPanel user in question to have them regenerate all of the maildirsize files and ensure their accuracy within the WHM.
/usr/local/cpanel/scripts/generate_maildirsize --confirm CPUSER
3. After regenerating the maildirsize files, the user's email_accounts.json needs to be moved aside:
mv -v /home/CPUSER/.cpanel/email_accounts.json{,-bak}
Moving aside email_accounts.json forces the file to be regenerated the next time the Email accounts
Additionally, you can run the following command to perform the script for all of the cPanel accounts on the server.
/usr/local/cpanel/scripts/generate_maildirsize --allaccounts --confirm