Appendix D. The checkcompat( ) Cookbook

Inside sendmail is the often overlooked checkcompat( ) routine. It has existed since V3, and is intended to allow the site administrator to accept, reject, and log mail delivery attempts. As sendmail continues to evolve, the need for this checkcompat( ) routine diminishes. It is no longer, for example, needed to screen for spam rejection because much of that can now be done in rule sets and the access database. On modern machines that support POSIX threads, the MILTER API allows external programs to perform all the tasks that formerly could be handled only by the checkcompat( ) routine.

But the checkcompat( ) routine still has a number of uses. Here are a few:

  • Capture the message body for each outbound message and send it via TCP/IP to a central archive host. Be sure to detect multiple recipients to avoid duplicate archived messages.[1]

  • Check the Received: headers on messages sent from one of your MX servers to see who sent it. This allows you to reject spam messages that try to do an end run around your access database. Sort the Received: headers by date and examine the second to the most recent.

  • Monitor a port for incoming commands, or a database of times. You might use this to defer delivery for particular recipients during selected windows of time.

  • Check for a particular header that means a copy of the message should be archived. You might use this to add a recipient (if not already present) that results in archival of the message (such ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.