Rules via SQL queries?
Julian Field
mailscanner at ecs.soton.ac.uk
Fri Nov 1 09:05:17 GMT 2002
At 00:58 01/11/2002, you wrote:
>At 02:25 PM 10/26/2002 +0100, you wrote:
>>What I have been thinking about is a slightly more general system than
>>that. You set a parameter to be the name of a Perl function. You write the
>>function, which is passed a message and returns a result for that rule.
>>Then you can easily write plugins that do things like this. You also write
>>an initialisation function that is called at startup for you to setup any
>>global state such as database conections.
>>
>>And you can develop them entirely independent of the MS distribution so
>>upgrading is simple.
>
>Question on that.. in exim, if I specify something like this in the config
>file:
>
>domainlist relay_to_domains = mysql;SELECT DISTINCT domain from domains
>WHERE mx1='mx10.tulsaconnect.com' AND domain='${domain}';
>
>..it executes that sql statement for *every* message that passes through -
>it does not just pull the list of domains once and cache it. In the system
>you describe above for MailScanner, does it execute the Rule for each
>message that is processed? (I think it does, but I just want to make sure)
It can do both :-)
You get to write an "InitYourFunction" function which is called once at
startup (or re-start, so it gets run once every 4 hours by default). This
function can create database connections, do SQL queries and cache the
results in a global variable, whatever you like.
You also write the "YourFunction" function which is called for every
message. Whether you make this do an SQL query to a database whose
connection you cached, or whether you just look up the results in a global
variable that was set by "InitYourFunction" is entirely up to you.
One way gets you more speed, the other way picks up any data changes
immediately.
--
Julian Field Teaching Systems Manager
jkf at ecs.soton.ac.uk Dept. of Electronics & Computer Science
Tel. 023 8059 2817 University of Southampton
Southampton SO17 1BJ
More information about the MailScanner
mailing list