procmail
[Top] [All Lists]

Re: Detecting multiple To: headers?

1999-05-13 12:02:50
John Conover asked,

C> So, what would the recipe be to detect multiple To: headers?

 :0 # flags and local lockfile if needed by action
 * -1^0
 * 1^1 ^To:
 action_in_case_of_multiple_To:_headers

Justin Lloyd had answered,

L> Same as before, except with the fix to the -1 scoring:

L> :0
L> * -1^0
L> *  1^1 ^To:
L> { LOG = "There were $= To: lines." }

That will operate on the right occasions but it will log erroneous informa-
tion.  With a message with five To: lines, it will say there are four.

These will be accurate:

 :0 # caution, this reports "1" for normal mail with one To: header
 * 1^1 ^To:
 { LOG="There are $= To: lines.
" }

or

 :0
 * -1^0
 * 1^1 ^To:
 { LOG="There are $= extra To: lines.
" }

or to log the full count but only if there are two or more,

 :0
 * -1^0
 * 1^1 ^To:
 { }
 :0A
 * $ $=^0
 * 1^0
 { LOG="There are $= To: lines.
" }

or the Philip Guenther way,

 :0
 * -1^0
 * 1^1 ^To:
 * - 2147483647^0
 * 2147483648^0
 { LOG="There are $= To: lines.
" }

<Prev in Thread] Current Thread [Next in Thread>