The Workspace

As was mentioned, rules exist to rewrite addresses. We won’t cover the reasons this rewriting needs to be done just yet, but we will concentrate on the general behavior of rewriting.

Before any rules are called to perform rewriting, a temporary buffer called the “workspace” is created. The address to be rewritten is then tokenized and placed into that workspace. The process of tokenizing addresses in the workspace is exactly the same as the tokenizing of rules that you saw before:

gw@wash.dc.gov    becomes  →   gw  @  wash  .  dc  . gov

Here, the tokenizing characters defined by the OperatorChars option (OperatorChars on page 1062) and those defined internally by sendmail caused the address to be broken into seven tokens. The process of rewriting changes the tokens in the workspace:

workspace is "gw" "@" "wash" "." "dc" "." "gov"
 R lhs rhs  R lhs rhsrules rewrite the workspace
 R lhs rhsworkspace is "gw" "." "LOCAL"

Here, the workspace began with seven tokens. The three hypothetical rules recognized that this was a local address (in token form) and rewrote it so that it became three tokens.

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.