Development info?

Julian Field MailScanner at
Sun Aug 24 21:51:11 IST 2008

Hugo van der Kooij wrote:
> Hash: SHA1
> Julian Field wrote:
>> Hugo van der Kooij wrote:
>>> Hash: SHA1
>>> Julian Field wrote:
>>>> A Custom Function is used to calculate the value of a configuration
>>>> setting for any particular message. The return value from the function
>>>> is just the value you want to use as the value of the configuration
>>>> setting. So if you used a custom function to work out the value of Spam
>>>> Actions, then a valid return value might be "store deliver" for example.
>>>> It is usually a string, except for settings that have a yes or no value.
>>>> No = 0 and yes = 1.
>>>> That's about all there is to it.
>>> The odd thing is that I am looking into the GenericSpamScanner sample.
>>> If I call the function from MailScanner like this:
>>> Use Custom Spam Scanner = &SearchMalware
>> No, that's not how it works. Read the docs for "Use Custom Spam Scanner"
>> in MailScanner.conf, it tells you exactly how to implement it. This
>> option "Use Custom Spam Scanner" is a simple yes/no result function, you
>> want to set it to "yes" if you want to implement this feature. It's
>> documented there, and explains exactly what to call the Custom Spam
>> Scanner function, where to put it, what parameters it is passed and what
>> it should return. There is even a complete example implementation for you.
>> So please RTM :-)
> The point is that the function is static in it's name. And there is
> allready a sample there. So if I want to write one myself what will
> happen with an upgrade? If I add a file I am sure it will be safe. But
> what if I decide to exchange it for my own? Will I loose it on the next
> upgrade of MailScanner.
No, you won't lose it. I thought of that :-)
It's treated just as if it were a configuration file, so it is not 
replaced or modified if it has been changed at all by the user (you).

> That is the bit that conviced me I should be looking for another function.
> is almost fully comments only. But is
> not. That would mean if I write my custom function in my own file that I
> would get back a default (and conflicting) one back with an upgrade.
Not if you modify the file (by commenting out or 
deleting the example that's there now).
> Last time I checked the file is not marked as
> document so it will be overwritten with an upgrade.
Wrong. From the spec file:

> Perhaps it would be feasable to name the function anyway I like it with
> a new config option. Then the conflict would not be there. Or you ship
> one fully commented out so there will be no conflicts by defining
> GenericSpamScanner twice.
No need, as explained above.
> Either of these two solutions will do to prevent the upgrade nightmare.
See above.

Have faith :-)


Julian Field MEng CITP CEng
Buy the MailScanner book at

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
PGP public key:

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the MailScanner mailing list