Using wildcards w/Rules

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

Moderators: KY Dave, jojobear99, Rdsok

Post Reply
CharlesB

Using wildcards w/Rules

Post by CharlesB » Thu May 13, 2004 5:20 pm

I am attempting to use a rule with a wildcard and cannot get the rule to fire. The expression/string I am attempting to use is: “X-Text-Classification:spam[9?.?]” without the quotes. This information is put in the header by K9, and the percentage (for spam) varies from around 80% to 100%. It is usually identified as [95.0%] or [82.3%], etc., but always enclosed in brackets [ ] with two leading digits, a dot/period, and a final digit followed by the % sign. I want my rule to fire only on spam where K9 determines the percentage certainty is 90.0% or greater, although I may adjust that percentage depending on my results. I am using PT beta 5, and have selected [Header], [Wildcard], [All Rows] and the string shown above, but nothing is happening. I also tried [Any Row]. Having learned from previous help here, I have NOT selected New Messages Only, although while that was useful in 3.0.3 I am not certain if it is applicable to this beta 5. Anyway, I have tried it both ways. Obviously, I still am having trouble properly constructing my rule, and any help would be appreciated. Thanks.

CharlesB

Post by CharlesB » Thu May 13, 2004 6:00 pm

Ooops! In the previous post, I should have said “The expression/string I am attempting to use is: “X-Text-Classification:spam[9?.?%]” without the quotes.” Sorry.

Guest

Post by Guest » Thu May 13, 2004 6:04 pm

I have figured out a way to do what you want.

It will work with multiple rules.

In your case,the DELETE RULE would have this criteria - HEADER , CONTAINS, [Spam][9, DELETE/MARK AS SPAM, IGNORE DON'T NOTIFY.

The MARK AS SPAM RULE would have this criteria - HEADER , CONTAINS, [Spam][8, MARK AS SPAM, IGNORE DON'T NOTIFY

and ADD a line with - HEADER , CONTAINS, [Spam][7, MARK AS SPAM, IGNORE DON'T NOTIFY.

and ADD a line with - HEADER , CONTAINS, [Spam][6, MARK AS SPAM, IGNORE DON'T NOTIFY.

Be sure to have rule set to ANY.

You could change the TEXT criteria as needed, I just provided the basic text, the trick is to change the number in each rule or segment of the rule.

I mentioned it in another thread. But was looking for a better way.

Guest

Post by Guest » Thu May 13, 2004 6:08 pm

:oops:

That was me :?

User avatar
Rdsok
PopTray Family
Posts: 1422
Joined: Fri Mar 19, 2004 11:36 pm
Location: Norman, Oklahoma USA
Contact:

Post by Rdsok » Thu May 13, 2004 6:08 pm

Who is me.. you still weren't logged in.. :D That method works also, its just not using wildcards, but is much simpler.

Darn, we are all posting at the same time, I'll leave my comments but ignore the corrections I made, instead look to make sure you don't have something protecting the email in question like a protect or important rule, or a whitelist item.

CharlesB,

Wow, almost exactly the same question twice. :D . KY Dave just ask an almost identical question but for using the new to the beta versions RegExpr. I'll first point out for you and others reading this that there are 2 ways that you can do this with the 3.1b v5 versions, the old method that is still valid for version 3.0.3 and the newer regular expressions way available in the betas. First lets correct your rule and then I'll link to the other thread for additional info.

You typed
X-Text-Classification:spam[9?.?]
and
have selected [Header], [Wildcard], [All Rows]
I don't believe that PopTray is case sensitive, but being the way I am I'll act like it is. I think that the word 'spam' is spelled 'Spam' but if I'm wrong just keep it the way you have it. The part you missed was the '%' that you had mentioned. So keeping the [Header], [Wildcard], [All Rows] part the same, make this what you fill the Text area with
X-Text-Classification:Spam[9?.?%]
That should correct your missing '%" sign, also make sure to not miss any spaces etc.

On the subject of using the new regular expressions...

Here is the thread that is almost identical to yours where I explain how to do this using regular expressions instead at RegExpr Request

This thread covers almost all the basics for regular expressions at Guide to Write Regular Expression Rules in PopTray

Hope that helps..
Rdsok

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 » Thu May 13, 2004 6:21 pm

Those two guest posting were mine, geesh, I don't remember how long ago I have been logged out. :oops:

I couldn't get it to work with the correct syntax either. That is why I suggested multiple rules.

But hey, the RegExpr you suggested in the other thread works for me. I changed the numbers in there and create 2 rules, one to mark as spam and the other to delete the spam.
KY Dave

Family Blog
You can STOP SPAM using PopFile and PopTray.

User avatar
Rdsok
PopTray Family
Posts: 1422
Joined: Fri Mar 19, 2004 11:36 pm
Location: Norman, Oklahoma USA
Contact:

Post by Rdsok » Thu May 13, 2004 6:57 pm

That is odd that the old method isn't working. I wonder if adding the RegExpr into the mix is somehow affecting the other search/match types such as the CONTAINS or WILDCARD criteria's. If that is the case, escaping the '[]' , '.' and the '-' in CharlesB's version would tell us. It would be easier to explain if it was a simple missing space or something, but I expect that at least KY Dave if not CharlesB had tried a 'cut' and 'paste' to avoid a typo issue. If any of us get time to 'play' with it some, it would be interesting to verify so Renier could address the issue when he has some time to.

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 » Thu May 13, 2004 8:46 pm

I did cut and paste as you mentioned, but to no avail.

I tried several versions of the rule.

One with [Spam][9?.?%]
One with [Spam][9?.??]
One with [Spam][9*]

All using SUBJECT, WILDCARD.

Finally, I went with SUBJECT, CONTAINS, [Spam][9 and it worked.

I don't know what keeps the wildcard from functioning properly.
KY Dave

Family Blog
You can STOP SPAM using PopFile and PopTray.

User avatar
Rdsok
PopTray Family
Posts: 1422
Joined: Fri Mar 19, 2004 11:36 pm
Location: Norman, Oklahoma USA
Contact:

Post by Rdsok » Thu May 13, 2004 9:19 pm

KY Dave,

This is what I was talking about. If having the regular expressions library in this build is affecting (which I doubt by the way) the other criteria the following will work. But, I really doubt if this is it.

All using SUBJECT, WILDCARD

Instead of this [Spam][9?.?%]
Try this \[Spam\]\[9?\.?%\]
or maybe \[Spam\]\[9?.?%\]

This will probably also work (more old style) but your other version is better using the CONTAINS.

Using SUBJECT, WILDCARD
[Spam][9*


(there would need to be several combinations to verify all posibilities. All I'm doing is using the escape character in posible conflict areas)

Of course, I guess it would be smarter to just ask Renier directly what it may be. :? duh

Again, I really doubt that is what is happening, only suggesting a possibility. It's also possible that I'll win the lottery, but I wouldn't hold my breath for it. :lol:

CharlesB

Post by CharlesB » Thu May 13, 2004 11:52 pm

Wow! :o I’m gone a few hours and return to find multiple solutions to a problem that had bugged me for several days. :lol: Many thanks, guys. With help like this, I may finally get a real handle on spam. I will be installing the new rules tonight. And Rdsok, the Spam vs. spam issue: K9 puts whatever you tell it to in the header, and I had elected the (lower case) spam. But thanks for seeing that and calling it to my attention.

User avatar
Renier
Site Admin
Posts: 1957
Joined: Mon Oct 15, 2001 12:54 pm
Location: Cape Town, South-Africa
Contact:

Post by Renier » Fri May 14, 2004 7:45 am

KY Dave wrote:[Spam][9?.?%]
I don't know what keeps the wildcard from functioning properly.
Always remember to add the asterixs in wildcards.

Code: Select all

*Spam[9?.?%]*
The reasons that PopTray doesn't add them automatically is so you can create wildcard rules for subjects start/ending with specific text.

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 » Mon May 17, 2004 10:07 pm

Thanks to Renier for pointing out my error, :oops:
I have now figured out how to filter the percentages placed in the subjects by K9 using WILDCARDS.

I use PopTray 3.1 Beta 5 and have 2 rules to filter the spam.

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

Code: Select all

MARK AS SPAM RULE

SUBJECT, WILDCARD, *[Spam][5?.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][6?.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][7?.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][80.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][81.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][82.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][83.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][84.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][85.?%]*

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

Code: Select all

DELETE SPAM RULE

ADD LINE ->  SUBJECT, WILDCARD, *[Spam][86.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][87.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][88.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][89.?%]*
ADD LINE ->  SUBJECT, WILDCARD, *[Spam][9?.?%]*

IGNORE DON'T NOTIFY, DELETE, ANY LINE
This example has the breaking point at 85.9% for MARK AS SPAM and above that is DELETED. Following this example, it would be easy for you to set the percentage at the point you would like to use.
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 2 guests