I would like to print the number of unread messages for all the email accounts belonging to a certain user. Is there a way to do it without root permissions?
One idea is to get the mailboxes with
and use something like the mailcheck tool for ubuntu, but I see there is no package for it on yum. Maybe there is a simpler way. I wanted an output similar to this:
Eventually I would like to create a page in cPanel for this, and/or add the actual count as a column in the email account list, but I'm not skilled enough on extending cPanel like that so for now I'll settle for a script that dumps the email count. Maybe put it in a php script later if I can run it in unpriviledged context somehow. 
One idea is to get the mailboxes with
Bash:
cpapi2 --user=username Email browseboxes account=someuser
Code:
[email protected]: NOTHING NEW
[email protected]: 2 UNREAD
[email protected]: 23 UNREAD