git clone https://gitweb.michael.orlitzky.com/mailbox-count.git
mailbox-count produces a simple count of mailboxes that exist per-domain in some SQL database. The default queries are compatible with the PostfixAdmin schema, but it is possible to supply your own queries, either on the command-line or in a configuration file.
The summary report lists each domain, along with the number of mailboxes owned by that domain. The order is determined by the summary query, which lists the domains alphabetically by default. The default detail report shows the same, but also contains a list of each individual mailbox (again in alphabetical order) belonging to the domains.
For example, the summary report:
user $ mailbox-count --database=postfixadmin.sqlite3
Summary (number of mailboxes per domain)
----------------------------------------
example.com: 3
example.invalid: 1
example.net: 2
example.org: 1
Or the more detailed report:
user $ mailbox-count --detail --database=postfixadmin.sqlite3
Detail (list of all mailboxes by domain)
----------------------------------------
example.com (3):
user1
user3
user5
example.invalid (1):
user7
example.net (2):
user2
user4
example.org (1):
user6
A full set of options and examples can be found in the man page.
All of the software dependencies are listed in the mailbox-count.cabal file. Just use cabal to build it.
Cabal handles the build, so do whatever you normally do to install cabal packages. If you just want to install it for your user,
user $ runghc Setup.hs configure --user
user $ runghc Setup.hs build
user $ runghc Setup.hs install
should do it.
Email them to me at michael@orlitzky.com.