
maf at eurotux
Feb 1, 2012, 10:23 AM
Post #4 of 8
(298 views)
Permalink
|
Just tested with this: +--------------+---------------------+--------------------+ | username | preference | value | +--------------+---------------------+--------------------+ | @fatias.pt | header TEST_SUBJECT | Subject =~ /test/i | | @fatias.pt | score TEST_SUBJECT | 30 | | @fatias.pt | score GTUBE | 10 | +--------------+---------------------+--------------------+ Catched Mysql doing this: SELECT preference, value FROM userpref WHERE username = 'manel [at] fatias' OR username = '$GLOBAL' OR username = CONCAT('@','fatias.pt') ORDER BY username ASC (I've changed the '%' for a '@', as I need exact domain matches, hence the username entries with '@'domain) result is: +---------------------+--------------------+ | preference | value | +---------------------+--------------------+ | header TEST_SUBJECT | Subject =~ /test/i | | score TEST_SUBJECT | 30 | | score GTUBE | 10 | +---------------------+--------------------+ GTUBE works, TEST_SUBJECT does not Thanks for the replies! On 02/01/2012 05:01 PM, Axb wrote: > On 02/01/2012 05:52 PM, Kris Deugau wrote: >> Miguel Fernandes wrote: >>> Hi! >>> >>> I'm just wondering, is there a limitation on the type of rules that can >>> be added to the SpamassAssin rules table? >>> Because adding something like (subject scoring): >>> >>> header TEST_SUBJECT Subject =~ /test/i (I've tried several combinations >>> of fields: preference & value, with no success) >>> score TEST_SUBJECT 30 (this one is possible) >>> >>> Does not seem straightforward... >>> >>> My goal is to be able to score subjects through sql rules. >> >> It should be possible with something like (untested): >> >> INSERT INTO userpref (username, preference, value) VALUES >> ('@GLOBAL','header TEST_SUBJECT','Subject =~ /test/i'); >> >> I don't know if @GLOBAL entries like that will be preloaded like the >> stock rules or any of the other file-based config, or if that's just a >> shortcut for something to be retrieved for all users on a userprefs >> lookup. If it's the latter (I'm pretty sure it is), you'll have to >> enable allow_user_rules. >> >> FWIW, this is probably the wrong way to solve whatever problem you're >> seeing. If you can describe why you want to do this, someone can >> probably give you a better way to do it. > > > Check: > > http://wiki.apache.org/spamassassin/UsingSQL > > "Global, Per-Domain, and Per-User Preferences via SQL" > > This setup works. (thanks Dallas) > > -- Cumprimentos, Miguel Fernandes
|