CLI - checking all of the email addresses of a user for new email
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 [CODE=bash]cpapi2 --user=username Email browseboxes account=someuser
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. ;)
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:
email-1@example.com: NOTHING NEW
email-2@example.com: 2 UNREAD
email-3@example.com: 23 UNREADEventually 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. ;)
-
I'm not sure in browseboxes will give you a list of new email Well if you're using maildir new mail is stored in /home/$user/mail/$domain.tld/$emailuser/new/
you could use something like the one-liners discussed here to provide a report How to count number of files in each directory? as long as you retain the command to your home dir (/home/$user) and you have shell access you shouldn't have a problem.0 -
Thanks for the tip I'll check that out 0
Please sign in to leave a comment.
Comments
2 comments