MDaemon stores cached quota values in the mailbox's hiwater.mrk file. Normal mail activity throughout the day will adjust the counts. There is a setting to recalculate all quota values once per day, during nightly maintenance (Setup | Account Settings | Quotas | Recalculate all quota values once per day). If quota counts are regularly getting out of sync this will help, but it can also put a large load on your server during the nightly maintenance.
Things like AccountPrune.exe, powershell scripts, or anythign else that acts on your mailbox outside of MDaemon can cause quota counts to be wrong.
Also on the same dialog make sure you have "Include all email folders in quota calculation" and "include Calendar, Contacts, Tasks, Dcoumentation folders as well" both checked.
Hidden files can also skew the counts. You shouldn't have any but just to be sure run the following command in the mailbox directory:
dir /a:h /s
When MDaemon calculates the quotas it intentionally ignores the WC and _ActiveSync directories and it ignores *.MRK, *.LCK, *.RTE, and Quota.msg files.
You can get the size of the WC directory by running:
dir "<maildir>\WC" /s /a
You can get the size of the _ActiveSync directory by running:
dir "<maildir>\_ActiveSync" /s /a
To get the size of all MRK, LCK, and RTE files run this powershell script (be sure to update $MailDir first):
$MailDir = 'C:\MDaemon\Users\domain.com\user\'
Get-ChildItem -Path $MailDir -Recurse -Force -Include *.mrk,*.lck,*.rte -File |
Measure-Object -Property Length -Sum |
Select-Object @{n='Files';e={$_.Count}}, @{n='Bytes';e={$_.Sum}}, @{n='MB';e={[math]::Round($_.Sum/1MB,2)}}
On my test account the quota shown by MDaemon was 75 MB lower than what was being shown by Windows. When I removed all of the items MDaemon excluded it was almost spot on.
Both MDaemon and Windows are using a 1024 base to convert bytes to MB.
Let me know if you have any other questions.