Wanting to count number of emails a single account sends in X time


Well-Known Member
Sep 20, 2013
cPanel Access Level
Root Administrator

so I have used whmapi1 emailtrack_user_stats to get the total number of emails sent in a given time for each account on my cpanel servers, but I would like to be able to count the amounts of email a single email account has sent to write an auto suspend script for just that account if it goes over certain limits. Stopping all mail to the cpanel account seems overkill.

The easiest way I can see is if I could get a hold of the number that WHM's "Email Delivery Report" returns (The search matches X records at the top of the page) when I search for an exact match for a From Address.

Is that possible? Or is there a UAPI or API2 command I've overlooked or some other easy way?

I'm trying to avoid writing something of my own that searches exim_mainlog and counts.
I have used:
exigrep '<= .*@example.com H=' /var/log/exim_mainlog | fgrep '<='
for a test so far, and it does return only sent emails it seems, but in a live test it returned about 1790 records vs the delivery reports almost 2200.

Last edited:


Staff member
Apr 11, 2011

First, I'd like to provide you with some information about a new feature in cPanel version 68:

Large Amount of Outbound Email Detected notification
In cPanel & WHM version 68, we added the Large Amount of Outbound Email Detected notification to WHM's Contact Manager interface (WHM >> Home >> Server Contacts >> Contract Manager). The system counts every user's outbound messages every 15 minutes. It will send a notification when a mail user exceeds the preconfigured threshold of 500 unique outbound messages over the previous hour (excluding mailing lists). This will help the administrator detect potential spammers or compromised accounts.

  • This notification defaults to disabled on existing systems and enabled for new installations.
  • We do not currently offer the option to configure the threshold.
This allows you to receive an email notification if an individual email account exceeds 500 unique outbound messages in an hour.

As far as your custom script, the WHM API 1 function you may find useful is:

WHM API 1 Functions - emailtrack_search - Software Development Kit - cPanel Documentation

Or, if you were willing to spend some more time developing a custom script that scans for eximstats data, you can take a look at the following file for an example of how we collect eximstats data:

There's also a thread here you may find helpful:

Fetch data from sqlite database

Thank you.