The RHS
The purpose of the RHS in a rule is to rewrite the workspace. To make this rewriting more versatile, sendmail offers several special RHS operators. The complete list is shown in Table 18-2.
RHS |
§ |
Description or use |
|
Copy by position | |
|
Rewrite once (when used as a prefix), or specify the user in a delivery-agent “triple,” or specify the default value to return on a failed database-map lookup | |
|
Rewrite and return (when used as a prefix), or specify the host in a delivery-agent “triple”, or specify an argument to pass in a database-map lookup or action | |
|
Rewrite through another rule set (such as a subroutine call that returns to the current position) | |
|
Specify a delivery agent or choose an action, such as to reject or discard a recipient, sender, connection, or message. | |
|
Canonicalize hostname | |
|
Perform a lookup in an external database, file, or network service, or perform a change (such as dequoting), or store a value into a macro. | |
|
Delay conversion of a macro until runtime |
Copy by Position: $digit
The
$
digit
operator in the
RHS is used to copy tokens from the LHS into the workspace. The
digit
refers to positions of LHS wildcard
operators in the LHS:
R $+ @ $* $2!$1 ↑ ↑$1 $2
Here, the $1
in the RHS indicates tokens matched by the first wildcard operator in the LHS (in this case, ...
Get Sendmail, 3rd 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.