${currHeader}
Current header’s value V8.10 and later
The ${currHeader}
macro is given a value whenever a header-checking
rule set is called. Header rule set checking is
declared as part of the H
configuration command, as for
example:
LOCAL_RULESETS HSubject: $>ScreenSubject
Here, sendmail will gather the
text following the Subject
: header in the mail message and
supply that text to the ScreenSubject
rule set. Usually, that
text is treated as an address. All RFC comments are
stripped and extra interior spaces are removed, but
when you want that text to be supplied intact and as
is to a rule set, you can employ this ${currHeader}
macro.
To illustrate, consider the need to reject messages
that have 10 or more consecutive spaces in the
Subject
:
header. Such Subject
: headers often indicate a spam
message:
Subject: Rates DROPPED! Lenders COMPETE for mortgage LOANS! 83419
One way to screen for such headers might look like this:
LOCAL_CONFIG
Ksubjspaces regex -a.FOUND [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
LOCAL_RULESETS
HSubject: $>+ScreenSubject
SScreenSubject
R $* $: $1 $(subjspaces $1 $) ← won't work
R $* . FOUND $#error $@ 5.7.0 $: "553 Subject: header indicates a spam."
R $* $: OK
The K line sets up a regular expression that will look
for 10 consecutive space characters. The first rule
in the rule set attempts to find 10 consecutive
spaces in the workspace by passing the workspace to
the subjspaces
regular expression map.
But this won’t work. The workspace contains the
Subject
: header’s text after ...
Get sendmail, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.