sales@mailtest.he.net
is tokenized to:
"sales" "@" "mailtest" "." "he" "." "net"
(The quotes are merely there to indicate tokens)
S4 R$* <@> $@ handle <> and list:; R$* < @ $+ . > $* $1 < @ $2 > $3 R$* < @ *LOCAL* > $* $1 < @ $j > $2 R$* < $+ > $* $1 $2 $3 defocus R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3Rules in a ruleset are invoked sequentially until either the end of the ruleset or a special operator is used to cause the ruleset to terminate.canonical R@ $* $@ @ $1 ... and exit R$+ % $=w @ $=w $1 @ $j u%host@host => u@host
Rpattern tab substitution tab commentThe pattern, substitution, and comment must be separated by a tab. They may contain spaces.
Rules are invoked repeatedly until it is either false or a special operator is used to cause the rule to terminate.
Given the workspace:
"sales" "@" "mailtest" "." "he" "." "net"
the rule:
R$+@$+ orders @ $2
will rewrite the workspace to:
"orders" "@" "mailtest" "." "he" "." "net"
If you are familiar with perl you might think of a rule being analogous to the following:
$line =~ s/pattern/substituion/;The only difference being is that perl pattern matching operates at the character level and sendmail pattern matching operates at the token level.
abc match the string literal abc @ < > . more literals (no special meanings) $* match zero or more tokens $+ match one or more tokens $=w pattern match one token against class (defined with Cw or Fw) $~w pattern match one token against class (defined with Cw or Fw)
abc insert string literal abc $1 insert first matched symbol $2 insert second matched symbol, and so on. $(domaintable $2 $) a lookup using a database file. $[ $1 $] canoncalize (lookup using DNS) token $1 $>96 $1 call ruleset 96 with workspace $1
$: check this rule once $@ check this rule once and exit ruleset if true. $# set mailer information. warning: changes meaning of $: and $@ when encountered later in same rule.
DMxyzdefines the macro $M to be equal to "xyz" which can be used in substituions or patterns.
Cwlocahostsets the class $=w to "localhost". The line
Fw/etc/sendmail.cwloads the class $=w from a file.
Mlocal, P=/usr/bin/procmail, F=lsDFMAw5:/|@qShP, S=10/30, R=20/40,
T=DNS/RFC822/X-Unix,
A=procmail -a $h -d $u
The 10/30 specifies rules for rewritting the envelope/header. Rule S10 is
to be invoked for the envelope and S30 for the header.
Ruleset 0 is invoked to determine the delivery agent. This rule results in what is called a triple. A triple is just the information needed to decide on how the message is to be delivered.
Ruleset 2 is invoked next.
The ruleset specified by the R= parameter of the local delivery agent is inoked next.
Ruleset 4 is invoked last.
sendmail -btYou can then run your rules on an email address by typing them like so:
3 sales@mailtest.he.netor
3,0,2,10,4 sales@mailtest.he.net