check_data
Check just after DATA Policy rule set
The check_data
rule
set can be used to validate recipients after all
recipients have been declared with SMTP RCPT To:
commands. Other
uses for the check_data
rule set include screening a
combination of sender and recipient, and evaluating
connection-based information.
The check_data
rule
set is called from inside
sendmail just after the SMTP
DATA command is received, but before that command is
acknowledged:
RCPT To: <gw@wash.dc.gov> 250 2.1.5 <gw@wash.dc.gov>... Recipient ok DATA ← called here 354 Enter mail, end with "." on a line by itself ← usually acknowledged here
The workspace passed to the check_data
rule set is a count of the
number of envelope recipients—that is, the number of
accepted SMTP RCPT
To:
commands. One use for this rule set
might be to reject messages that specify too many
envelope recipients. Consider the following
mc configuration
lines:
LOCAL_CONFIG Kmath arith LOCAL_RULESETS Scheck_data R $- $: $(math l $@ 19 $@ $1 $) # reject >=20 envelope recipients R FALSE $# error $@ 5.7.1 $: "550 Too many recipients"
Here, we add two new sections to our
mc configuration file. The
first, under LOCAL_CONFIG, defines a database map of
type arith
(arith on page 898).
In the second section, following the LOCAL_RULESETS,
we declare the check_data
rule set. That rule set is
followed by two rules. The first rule looks up the
workspace (the LHS $-
) that contains a count of the envelope recipients. The RHS of that rule looks up that value ...
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.