Name
check_data
Synopsis
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 hereThe 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).
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 using the
math database map comparing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access