The logic I had intended to implement in the MailScanner whitelisting was too complex; it turns out I can do it much more easily. Each message is individually passed from MailScanner to my custom function. I was under the impression, that if I used two functions invoked during different phases of the scanning, I would have to create some sort of inter-process communication to pass data from the first to the second. That is wrong, and unfortunately wasted a couple of hours of my time. I have the following directives in MailScanner.conf:

Information Header Value = &JPscanHead;

Is Definitely Not Spam = &JPscanWhite;

What now happens is that JPscanWhite does the actual lookup in the directory as previously described and caches the current message identifier in a Perl hash, indicating if the message (the combination of sender and recipient) is on a white list or not. As I haven’t been able to set a header in the message before it is passed on to the next group of servers, I use the JPscanHead custom function to modify the information header (i.e. the value of Information Header) to indicate if the message is whitelisted or not. I’ve thrown a few thousand messages against this to test it, and works very satisfactorily. Keep it simple. ;-)

Mail, Exim, and Linux :: 10 Jan 2007 :: e-mail