PHP Script Live Count Email Account on cPanel

saelendra

Registered
Nov 28, 2013
2
0
1
cPanel Access Level
Website Owner
Hello :)

Anyone knows about how to making script live count for email on cPanel?
So everytime user creating email, this script will be automatically update for amount email on cPanel.
Previously I will tell you I have website and I want all visitor know how many user now on my website.
Any help will be appreciated :) Sory for my english, so bad. Thanks.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,912
2,241
363
Hello :)

This would involve developing a custom script that utilizes our API. The "Email::listpops" module would likely be helpful:

cPanel API2 - Email

Thank you.
 

saelendra

Registered
Nov 28, 2013
2
0
1
cPanel Access Level
Website Owner
Dear Michael,

Previously thanks for your answer :)
Can you tell me more specific how using this API "Email::listpops"?
If possible, please give example with script maybe.
Thanks so much for your help. Sory I'm newbie.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,912
2,241
363
Do you have root access to this server or do you only have cPanel access? The API2 function is documented here:

Email::Listpops

You may need to consult with a developer if you need assistance with the custom script you are planning to create.

Thank you.
 

Erik Knepfler

Member
Sep 2, 2014
14
0
1
Long Beach, California, United States
cPanel Access Level
Root Administrator
I know this is an old thread but I too wanted to solve this, and I felt that there likely was a simpler answer. Here's mine:

find /home -type f -name "maildirsize" > mailboxes.log

I chose that filename after creating a brand new email account, never accessed, and looking inside for unique files I could search for. That seemed like a good one.

I use Exim/Dovecot but not sure if that makes any difference. YMMV, do the same, make a fresh account and look inside.

There will be one extraneous result per account under /home/accountname/mail/maildirsize but with a simple regex search/replace you should be able to quickly eliminate that, such as replacing .*?/mail/maildirsize.* with blank in your text editor, then collapsing the blank lines.

Then just search/replace all of the / characters with commas, load into Excel as a CSV, make a PivotTable and you're done :)