This is very silly, but how about
cat /path/to/mailbox | formail -s echo | wc -l
jcl
"dr" == Dallman Ross <dman(_at_)netcom(_dot_)com> writes:
From: Kenny Nguyen <kenn(_at_)xuviet(_dot_)org>
I'm wondering if anyone can help me with a recipe that counts how
many email msges in a mailbox and how much diskspace that mailbox has
taken up already. Basically I"m trying to limit a pop account from
receiving lots of emails. So if the diskspace has reached or the
number of emails exceeded the preset value then just dump the email or
bounce back.
dr> People have published ways to do this inside procmail in the past. One
dr> easy way outside of procmail (using a process you call from within
dr> procmail) is to rely on "messages", which is part of the elm package.
dr> 8:03am /netcom10:~> messages
dr> There are 10 messages in your incoming mailbox.
dr> "frm" also can count:
dr> 8:08am /netcom10:~> frm -n -q -S
dr> You have 1 new message, 7 unread messages, 2 read messages.
dr> You can also tell it to report only on one or the other of those
dr> categories.
dr> For size you could use df or ls, though there may be a method internal
dr> to procmail that I don't know about.
dr> --
dr> \ .-. .-. .-. .-. .-. .-. .-. /
dr> \-d-/-m-\-a-/-n-\-(_at_)-/-n-\-e-/-t-\-c-/-o-\-m-/-.-\-c-/-o-\-m-/
dr> '-' '-' '-' '-' '-' '-' '-' '-'
--
Justin C. Lloyd Harris Corporation, ISD Voice 407/984-5558
jlloyd(_at_)harris(_dot_)com 505 John Rodes Blvd. Fax
407/984-6323
Unix System Administrator Melbourne, FL 32935 Office W3/1811B