How do Milter filters and Sendmail communicate ?

 
 
 
Basically, Milter filters communicate with sendmail using (local or remote) sockets and can read/alter the messages (body, headers) going through the sendmail MTA.
Using a Milter solution is really easy : just declare it in your sendmail.mc and rebuild a new sendmail.cf. As you can see on the sendmail.org pages you just have to add some instruction such as :
 INPUT_MAIL_FILTER(`filter1', `S=unix:/var/run/f1.sock, F=R')
to mention you want to use a Milter called filter1 through the Unix socket namely /var/run/f1.sock
You can run several Milters based on your needs run in some sequential order.
Of course, make sure you start your Milter filter(s) first and then Sendmail.
Using Milter that add/change headers or alter the body will generate in a lot of messages being logged in the sendmail's log. You can reduce the milter logging by using :
confMILTER_LEVEL
in your sendmail.mc (use 6 for instance instead of the default : 9) As you can see on Sendmail's tweaking there are other MILTER options you can use in your sendmail.mc :
confMILTER_MACROS_CONNECT
confMILTER_MACROS_HELO
confMILTER_MACROS_ENVFROM
confMILTER_MACROS_ENVRCPT
which can be used to communicate some sendmail's Macro to Milter programs. Using sendmail's macros in Milter can be usefull to bypass some filtering in some cases (authenticated users or networks). New features related to Milter will appear in sendmail 8.13 some of which are available for testers as FFR : FFR_MILTER_PERDAEMON for instance makes it possible to define some Milters through some DAEMON_OPTIONS hence making it possible to bypass running some Milters for some IPs/ports/MSA .