If you have Sharp ROM 2.38 or 3.10 or 3.13, and your inbox is just one massive file try this from /home/root (path and searchkey may be different in 3.1 versions) and tell me what ROM you have and what you get:
grep internalid Applications/qtmail/inbox.txt | sort | more
On my 2.38 machine, I get many duplicate and some triplicate or quadruplicate entries, and can only erase one copy. qtmail forgets that the rest of the entries are there.
Then try this to see how many emails there are, if any, in your inbox.txt file that you thought you deleted, comparing the number of lines to the emails you find qtmail saying you have in your inbox:
grep internalid Applications/qtmail/inbox.txt | wc
If you have Sharp ROM 3.10 or 3.13, and the email inbox is not just one massive text file, then what format is it in...is it one directory with separate emails, or a bunch of directories with single emails, or what?
I'm working on a script to erase the duplicates, but may just upgrade to a 3.1 if the problem has been resolved there.
sdjf