I suggested to Ken Marsh,
| > Well, we can do it with formail, though, and you won't need the disk space
| > for countat.
Ken responded,
| I wasn't aware that formail could count. I could let have it seperate
| out fields and then count the fields with another program...?
Well, no, formail itself can't count (except with FILENO, which doesn't apply
here and is usually a bear to use when it does). I used formail to capture
all the visible recipient headers into a variable and then procmail to count
the indications of separate addresses in that variable.
| There's still exec overhead...
Yes. Philip Guenther's solution doesn't use any outside programs, but it
misses some addressees if there is more than one To: line or more than one
Cc: line (or when we're following Resent- headers, more than one Resent-To:
line or more than one Resent-Cc: line). formail -x fieldname: will get
all of them, but it means an exec.
| I can't find where a condition is actually an external program, except
| in the case of "?".
Well, yes, because "?" is the way to use an external program's exit status in
a condition, just as ` ` (with the "$" modifier) is the way to use an exter-
nal program's output in a condition.
| > "h" means "pipe, save, or filter only the body." It is meaningless if
| > the action line is a left brace. The default is "hb".
|
| Question, does that mean "pipe, save, or filter only the body" for
| the conditions, or the action taken? I think it means for the action.
Yes, "h" and "b" are for the action. "H" and "B" are for the conditions.
| > (Unfortunately extraction into $MATCH will not get multiple
| > headers with the same field name; we can get the first or the last that way
| > but not both nor any in betweeen.)
|
| Oops. Possible big problem. Spam and such are not known for their
| RFC-822 compliance. I guess if I set it up for whatever sendmail
| does (first occurance, I think, not sure) it'll work OK.
If there are multiple To: headers or multiple Cc: headers or both, all the
addresses in them are supposed to be recipients.