Beginning with V8.12, sendmail offers hooks to access external programs via sockets, and a library to build external programs to listen on sockets. We first discuss the hooks inside the configuration file in support of external programs, and after that briefly discuss building your own program.
To access external programs via sockets from sendmail, you need to compile sendmail with the MILTER compile-time macro defined. To build sendmail in this way, simply add a line such as this to your m4 Build file:
Then, build sendmail in the usual manner.
If you are using precompiled sendmail, you can detect if it was built with the MILTER compile-time macro defined by running the following command:
/usr/sbin/sendmail -bt -d0.4 < /dev/null
If MILTER was defined, it will appear among a list of other defined macros in a line that will look something like this:
Compiled with: DNSMAP LOG MAP_REGEX
MILTERMIME7TO8 MIME8TO7 ↑note
If it doesn’t appear, you will need to either download the sendmail source and build it yourself, or contact your operating system vendor and request a properly compiled version in binary form.
With MILTER enabled, sendmail offers a way to submit messages to external programs that can be used to screen messages for spam indicators, viruses, or other content that you might want to reject. At the end of this chapter, we will show you the library routines to use when ...