countmail
Jordi blogs about mail (in reply to a number of other people), and mentions a rather interesting application.
wouter@country:~$ countmail ZERO! ZERO MAIL MESSAGES! HAHAHAHAHA! wouter@country:~$
Unfortunately, all is not what it seems. Apparently countmail doesn't support Maildir.
I had a one-line shell script that counts maildirs. Something like this for all messages:
find mail/INBOX -path '/new/' -o -path '/cur/'|wc -l
Remove the "-o -path '/cur/'" for just unread messages.