Tying it all together

LOCAL_CONFIG
# Maps
Kmacro macro
Karith arith

# Header Checks
HTo: $>CheckTo
HCC: $>CheckTo

# Header to add
H?${BadRcpts}?X-Possible-Spam: To: headers have ${Rcpts} recipients

# Macro
D{Rcpts}0
D{MaxRcpts}20

LOCAL_RULESETS
SCheckTo
# Record the presence of the header
R$* @ $*		$: $(arith + $@ $&{Rcpts} $@ 1 $) $| $2
R$+ $| $*		$: $(storage {Rcpts} $@ $1 $) $>CheckTo $2

Scheck_eoh
# Check the macro
R$*			$: $&{Rcpts}
# Check if above max
R$+			$: $(arith l $@ ${MaxRcpts} $@ $1 $)
# set it
RTRUE			$: $(storage {BadRcpts} $@ OK $)
# clear it
RFALSE			$: $(storage {BadRcpts} $)

Prev