procmail
[Top] [All Lists]

Re: Simple Email Counter Needed

1999-09-01 00:13:05
On Tue, 31 Aug 1999 09:47:00 -0700, Roy Harvey <roy(_at_)hearme(_dot_)com> 
wrote:
Looking for a simple counter recipe and script to count the number of
emails coming to a given address. I'm running Solaris Unix on Sparc.

Any particular reason you need to know within a Procmail recipe how
many messages the folder contains? For a summary report, just run
mailstat and extract results for the folder in question

 $ mailstat -l <$HOME/Mail/procmail.log | fgrep procmail
   44510    2618      17 inbox/procmail
(I.e bytes   avg    msgs  folder)

... or create your own adaptation of mailstat; it's supposed to be
tweaked to suit your needs.

If you really really need to know that e.g. the folder you are
delivering to contains, say, less than 1000 messages, something like
this should help:

    :0:
    * 1000^0
    * $ -`grep -c '^From ' folder`^0
    folder

If the expanded output of grep -c '^From ' folder is 1000 or more, you
get a negative score, and the action is skipped. (man procmailsc for
the full scoop on scoring recipes.)

Hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Simple Email Counter Needed, era eriksson <=