Creating filter rules for special header fields

General discussion about PopTray. You love it? You hate it? Talk about it here.

Moderators: KY Dave, jojobear99, Rdsok

Post Reply
samhome
First Timer
Posts: 3
Joined: Fri Jul 08, 2005 9:15 am

Creating filter rules for special header fields

Post by samhome » Fri Jul 08, 2005 9:17 am

Hello!

I want to create a rule that checks the header field "X-HE-Spam-Score" as my provider provides a very reliable spam rating in this header field.

How can I specify the field name? Thanks for your help,

Sam

User avatar
lemming
Groupie
Posts: 55
Joined: Sun Jan 09, 2005 3:51 am
Location: Malaysia

Headers and spam scores

Post by lemming » Fri Jul 08, 2005 12:30 pm

If you just need to detect the presence of the header, you can use the "Header" option under Area. This would parse thru all mail headers. The complete rule would be:

Header -> Contains -> X-HE-Spam-Score

But if you actually want to read the score and create rules based on it, you would need to use either wildcards or regular expressions (Regr Exp).

Some of us have a similar setup using K9, which also generates scores, and have written about it previously.

KY Dave favors using wildcards
viewtopic.php?p=9367#9367

On the other hand, I prefer to use regular expressions
viewtopic.php?t=1552&start=60
(Just scroll down to the last posting with the subject: reading spam percentages from K9)

It is clear which method I would advocate, but you can pick whichever is easier to for you.

samhome
First Timer
Posts: 3
Joined: Fri Jul 08, 2005 9:15 am

Post by samhome » Fri Jul 08, 2005 2:23 pm

Thanks for your quick answer, but I'm afraid I need a little more help.

I don't want to check for the mere presence of the header field, I need to check its content - the K9 Setups mentioned read out (as far as I could see) the subject, not a header field. I need something like:

Mark as spam if regular expression /\+\+(\+)*/ applies to header field "X-HE-SpamScore".

Thanks in advance,

Sam

User avatar
KY Dave
Not the Developer
Posts: 1599
Joined: Thu Mar 14, 2002 7:29 pm
Location: Burkesville, KY. U.S.A.
Contact:

Re: Creating filter rules for special header fields

Post by KY Dave » Fri Jul 08, 2005 3:08 pm

samhome wrote:Hello!

I want to create a rule that checks the header field "X-HE-Spam-Score" ......How can I specify the field name?
In your case, I suggest the following WILDCARD setup, It would look in the HEADER to find your spam marker (X-HE-Spam) and then look for the percentage. If below 86% the rules only MARK AS SPAM, 86% and above, the rules will DELETE it.

Your first rule MARKS AS SPAM any email with the percentage of 50.0% - 85.9%.

Code: Select all

MARK AS SPAM RULE

HEADER, WILDCARD, *X-HE-Spam-Score 5?.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*6?.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*7?.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*80.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*81.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*82.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*83.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*84.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*85.?*

IGNORE DON'T NOTIFY, MARK AS SPAM, ANY LINE
Your second rule DELETES any SPAM email with the percentage of 86.0% - 99.9%.

Code: Select all

DELETE SPAM RULE

ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*86.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*87.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*88.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*89.?*
ADD LINE ->  HEADER, WILDCARD, *X-HE-Spam*9?.?*

DELETE, ANY LINE
This example has the breaking point at 85.9% for MARK AS SPAM and 86.0% and above is DELETED. Email below the 50% threshold is not flagged.

Following this example, it would be easy for you to set the percentage at the point you would like to use.

If you need more help, include in your post a small snippet of your header showing the phrase you're wanting to find and the per centage.
Don't include personal info.
KY Dave

Family Blog
You can STOP SPAM using PopFile and PopTray.

samhome
First Timer
Posts: 3
Joined: Fri Jul 08, 2005 9:15 am

Post by samhome » Tue Jul 12, 2005 1:15 pm

Indeed, it works perfectly.

Thank you very much!

User avatar
homaquebec
PopTray Family
Posts: 913
Joined: Tue May 27, 2003 6:47 pm
Location: Québec (Canada)

Post by homaquebec » Sat Jul 30, 2005 6:32 pm

KY Dave,

Your rules are interesting. Your post gave me the idea to create alike ones that seem easier :

Subject, Wildcard, [Spam][9*]* --- Delete on server
etc. by addind lines for messages that I want to be deleted on server.

And

Subject, Wildcard, [Spam][7*]* --- Mark as spam
etc. by adding an other line for messages that I want to be marked as spam.

User avatar
KY Dave
Not the Developer
Posts: 1599
Joined: Thu Mar 14, 2002 7:29 pm
Location: Burkesville, KY. U.S.A.
Contact:

Post by KY Dave » Sun Jul 31, 2005 2:14 am

You probably meant to include 8*]* in your posts
but you're right, there are easier places to break the DELETE or MARK AS SPAM point.

The example I posted, showed the technique to have the break point at any whole number, not just at a number divisible by 10.
KY Dave

Family Blog
You can STOP SPAM using PopFile and PopTray.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests