View previous topic :: View next topic |
Author |
Message |
rc-flitzer
Joined: 02 Jan 2007 Posts: 3
|
Posted: Tue Jan 02, 2007 3:51 pm Post subject: Regular expression in black rule doesn't work |
|
|
Hello!
First of all I like to say "Fine tool!" because AntispamSniper is very good and it filters almost every mail correctly. But I have a problem concerning the black rules list. I added an own black rule but it isn't working and I can't find the error.
There is a server-based spam filter for one of my e-mail adresses which labels every mail with some items in mail header. If a mail is recognized as spam, there will be something like the following content in mail header:
Code: | X-Spam-Flag: YES
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
mailhost.xxx.de
X-Spam-Level: *************
X-Spam-Status: Yes, score=13.7 required=5.0 tests= [...] |
If the mail's not spam, the last line will be starting with "X-Spam-Status: No, score=".
So my rule set is just containing a single rule: "Header{X-Spam-Status} =~ (?:yes)". But it's not working. AntispamSniper does not use this rule. Does someone know why? It's a very simple regular expression according to AntispamSniper input patterns.
Another additional question: it would be better to check the beginning of a header element (in this case: "^yes"), but the header line is starting with "X-Spam-Status: ". So I don't know how the "^" character is validated: either beginnig of a header element's content or the whole header element line. |
|
Back to top |
|
|
vetaltm Author
Joined: 05 Feb 2006 Posts: 748
|
Posted: Tue Jan 02, 2007 4:52 pm Post subject: Re: Regular expression in black rule doesn't work |
|
|
rc-flitzer wrote: |
There is a server-based spam filter for one of my e-mail adresses which labels every mail with some items in mail header. If a mail is recognized as spam, there will be something like the following content in mail header:
Code: | X-Spam-Flag: YES
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
mailhost.xxx.de
X-Spam-Level: *************
X-Spam-Status: Yes, score=13.7 required=5.0 tests= [...] |
If the mail's not spam, the last line will be starting with "X-Spam-Status: No, score=".
So my rule set is just containing a single rule: "Header{X-Spam-Status} =~ (?:yes)". But it's not working. AntispamSniper does not use this rule. Does someone know why? It's a very simple regular expression according to AntispamSniper input patterns.
|
The regular expression is correct. There was a bug with the conditions applied to custom headers (the plug-in was unable to match the content of custom headers having upper-case letters). Please update to the latest build:
http://dl.antispamsniper.com/download/1.8/sniper-mui-1.8b5.exe - commercial version
http://dl.antispamsniper.com/download/1.8/sniper-mui-free-1.8b5.exe - free version
Version 1.8.x allows restoring the messages deleted from server by headers. Thereby you can avoid a false positive, even if SpamAssassin will suddenly made it.
rc-flitzer wrote: |
Another additional question: it would be better to check the beginning of a header element (in this case: "^yes"), but the header line is starting with "X-Spam-Status: ". So I don't know how the "^" character is validated: either beginnig of a header element's content or the whole header element line. |
The conditions are applied to the content of header elements, not to the whole headers. So indeed you can use in expressions "^", "$" etc. for better performance.
Thank you for finding such an old and dirty bug! |
|
Back to top |
|
|
rc-flitzer
Joined: 02 Jan 2007 Posts: 3
|
Posted: Tue Jan 02, 2007 6:23 pm Post subject: |
|
|
Thank you for the quick and helpful answer. I installed version 1.8b5 of AntispamSniper, hoping the rules will work from now on. I'll report here whether it's successful or not.
A question to case-sensitiveness: does it matter using uppercase letters? In Perl regexp there's an option for switching between case-sensitive and not. How it's handled in AntispamSniper? |
|
Back to top |
|
|
vetaltm Author
Joined: 05 Feb 2006 Posts: 748
|
Posted: Tue Jan 02, 2007 6:46 pm Post subject: |
|
|
rc-flitzer wrote: |
A question to case-sensitiveness: does it matter using uppercase letters? In Perl regexp there's an option for switching between case-sensitive and not. How it's handled in AntispamSniper? |
The matching is always case-insensitive for the rule conditions. It means that you can use the letters of any case in regular expressions (excepting the special regexp metacharacters, defined as quoted commands like \s, \S etc.). |
|
Back to top |
|
|
rc-flitzer
Joined: 02 Jan 2007 Posts: 3
|
Posted: Thu Jan 04, 2007 5:21 pm Post subject: |
|
|
The new version 1.8b5 is running quite well. The bug is solved, filter rules using custom header fields are working just fine. |
|
Back to top |
|
|
|