I am using Postfix mail server. How can I count number of E-mails sent from a single account in an hour?
2 Answers
# now=`date '+%b %d %H:%M'`
# prev=`date '+%b %d %H:%M' -d "1 hour ago"`
# sed -n "/$prev/,/$now/p" /var/log/mail.log | egrep 'from.*someuser' | wc -l
-
1
-
You will need to mitigate spoofed mail at the MTA (spamassassin). Anything downstream (procmail, maildrop, etc) which could be of use is going to assume the envelope info is all legit. Oct 28, 2016 at 14:15
Give a look at pflogsumm
It can show a per-email-count sorted list of both sent and received email.