• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How do I count outoing emails per domain? (just a simple list)

rolo@

Basic Pleskian
All I need is something that will tell me how many emails each particular domain has sent. It doesn't even have to be very accurate, just ballpark numbers for a particular log file or even better for a particular period of time.

domain1.com 200
domain2.com 39
domain3.com 489
etc...


Thanks!
 
Nice idea, but, truly, it is technically quite difficult to implement this even in the newest Plesk versions. You see, when a mail user passes SMTP authorisation on the server to send an email, a record type 'smtp_auth' is added into the Plesk mail log (/usr/local/psa/var/log/maillog) to log this event. But the main problem is that each single 'smtp_auth' maybe followed by numerous mails having been sent by this user which is quite hard to trace, needless to say how messy this log looks when there dozens of well-functioning mailboxes on the server... I've been thinking about calculating the number of mails in the Qmail queues (/var/qmail/queue/*), however, it wouldn't work either: Qmail is so damn fast that you would hardly have a chance to parse\calculate the mail files in the queues... I wish there was such statistical feature on the domains, in a way like http://domain.com/plesk-stat/webstat/, say, http://domain.com/plesk-stat/mailstat...
 
Such a shame... And to think that with a simple string appended to each log entry this would be easily done...

Anyways, thanks for the input.
 
Check out this plesk maillog shell script for getting the count you're looking for. You can always remove the to or from in the regexp to see only a count of messages sent or received per domain.

-Matt MacDougall
 
Back
Top