Sendmail 8.13.3 Programmer's Guide
Table Of Contents

Control Flow of Milter APIs
Sample Filter Pseudocode
Chapter 3 51
To write a filter application, you must invoke different callbacks to
process relevant parts of a message transaction. The Milter library then
controls all sequencing, threading, and protocol exchange with Sendmail.
Table 3-1 outlines the control flow for a filter process and denotes
different callbacks invoked during an SMTP transaction.
Although Table 3-1 denotes only a single message, multiple messages
can be sent in a single connection. The remote host or Sendmail can
abort a message and connection anytime during the SMTP transaction.
If the abort occurs during a message processing (that is, between the
MAIL command and the final . command), the filter application calls the
xxfi_abort() API. The filter application calls xxfi_close() any time
when the connection closes.
Table 3-1 Milter Callbacks Related to an SMTP Transaction
SMTP Commands Milter Callbacks
(open SMTP connection) xxfi_connect()
HELO ... xxfi_helo()
MAIL From: ... xxfi_envfrom()
RCPT To: ... xxfi_envrcpt()
[more RCPTs] [xxfi_envrcpt()]
DATA
Header: ... xxfi_header()
[more headers] [xxfi_header()]
xxfi_eoh()
body... xxfi_body()
[more body...] [xxfi_body()]
. xxfi_eom()
QUIT xxfi_close()
(close SMTP connection)