The check_eom Rule Set

The check_eom rule set (V8.14 and later) is called after the terminating dot is received from the sending client, but before the xxfi_eom entry (Milter xxfi_eom() on page 1215) into any Milters is called. The check_eom rule set is called only if it exists in the configuration file; otherwise, it is skipped. When it is called, its workspace is passed an ASCII representation of an unsigned integer which represents the size of the message (header lines and body) in bytes (characters). This size is the same as the value stored in the ${msg_size} macro (${msg_size} on page 835).

The check_eom rule set can be used to validate the size of the message, but it does not have to be used in that way. Instead, you might, for example, have a policy that requires only one recipient per message. One way to use the check_eom rule set to enable this policy might look like the following:

Karith math
R$*            $: $(math = $@ $&{nrcpts} $@ 1 $)
R TRUE            $#OK
R FALSE             $#error $@ 5.1.3 $: "Policy limits one recipient per envelope."

Here, we first declare a database map of type arith called math (arith on page 898). In the second line, we declare the check_eom rule set, which, in this case, contains three rules (the R lines).

The first rule compares the number of recipients in the current value of the ${nrcpts} macro (${nrcpts} on page 837) to the constant value 1 to see whether the two are equal. The second rule matches if the two are equal (if the number of recipients is one) and ...

Get sendmail, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.