It's been said before, and it's worth repeating: qmail is a very modular email architecture. Because of this modularity, it is relatively easy to alter the behavior of the overall system by wrapping the basic components or by inserting a script or program between them. Filtering email is a perfect example of the power of this design. This is done by filtering the communication between architectural components; so while filtering email is the primary operation discussed in this chapter, filtering architectural interfaces is the method by which this expansion or modification of the architecture is achieved.
The basic qmail architecture, trimmed down to just the parts relevant to delivery (and thus filtering) of email, is shown in the following figure:
Almost any of qmail's components can be wrapped and used for filtering purposes. Which components to wrap depends on the specific behavior desired. In many cases there are multiple ways of achieving...