Path: utzoo!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!image.soe.clarkson.edu!nelson From: nelson@sun.soe.clarkson.edu (Russ Nelson) Newsgroups: comp.mail.sendmail Subject: The algorithm for rewriting rules Message-ID: <1990May31.152505.28721@sun.soe.clarkson.edu> Date: 31 May 90 15:25:05 GMT Article-I.D.: sun.1990May31.152505.28721 Reply-To: nelson@clutx.clarkson.edu Organization: Clarkson University, Potsdam, NY Lines: 54 A ruleset is like a subroutine that sendmail calls when it wants an address transformed. Sendmail calls rules 0 through 4 (or 6, depending on your version) by itself. You can call other rulesets as subroutines. Specific mailers can call rulesets for the sender or recipient. I can't find the algorithm for the application of the rewriting rules. As best I can determine from a source, this is it: Apply a rule. If it matches, rewrite it and apply the same rule again. If it doesn't match, try the next rule. If you start a RHS with $:, then after rewriting, apply the NEXT rule. If you start a RHS with $@, then after rewriting, exit this ruleset. If you start a RHS with $#, then after rewriting, exit this ruleset, and ruleset zero will see the $#, and use that information to deliver the mail using the given mailer. The picture given in the documentation that looks roughly like this: /----> 0 ----> resolved address | | /---> 1 ---> S ---\ | | | --> 3 -----> D ---| |---> 4 ----> Message | | \---> 2 ---> R ---/ is terribly misleading. It should really looks like this: ---> 3 -------> 0 ----> resolved address /---> 1 ---> S ---\ | | ---> 3 -----> D ---| |---> 4 ----> Message | | \---> 2 ---> R ---/ My documentation is not clear on whether the envelope's recipient or the header's To: is used to deliver the message. I hope this helps someone besides myself. If anyone can improve on it, please do. -- --russ (nelson@clutx [.bitnet | .clarkson.edu]) Russ.Nelson@$315.268.6667 Violence never solves problems, it just changes them into more subtle problems