Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Control Flow of Milter APIs
Sample Filter Pseudocode
Chapter 350
Sample Filter Pseudocode
The following pseudocode describes the filtering process from the
perspective of a set of N MTAS, each corresponding to an SMTP
connection.
For each of N connections
{
For each filter
process connection/helo (xxfi_connect, xxfi_helo)
MESSAGE:For each message in this connection (sequentially)
{
For each filter
process sender (xxfi_envfrom)
For each recipient
{
For each filter
process recipient (xxfi_envrcpt)
}
For each filter
{
For each header
process header (xxfi_header)
process end of headers (xxfi_eoh)
For each body block
process this body block (xxfi_body)
process end of message (xxfi_eom)
}
}
For each filter
process end of connection (xxfi_close)
}
The callbacks within parenthesis are placed beside the processing stages
in which they are called. If a callbacks is not defined for a particular
stage, the filter application can bypass that stage. The filter application
can abort processing at any time during a message, in which case the
xxfi_abort() callback is invoked and the control returns to MESSAGE.
Sendmail contacts the filter applications in the order defined in the
Sendmail configuration file.