AFAIK if your PHP has access to the mail folder on your system, you could always see who's logged in and count the number of messages (one file per message).
Or you could make them supply their mail username/password and store that and log in via imap or pop and manually run the command to get the count of messages in a folder.
Using this with cPanel may be an issue since I'm not sure what permissions cPanel puts on the system.
What have you tried so far to get this working? 99% of the people here won't just give you code; rather, we want to help you get your code working.