Is there any way to use If-Then-Else logic in an Outlook rule? For instance, I want to query a value in the header of all emails that has a numeric value. If it is greater than some value, I want to immediately delete it.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Rules logic (OL2002 SP2)
Home » Forums » AskWoody support » Productivity software by function » MS Outlook and email programs » Rules logic (OL2002 SP2)
- This topic has 21 replies, 4 voices, and was last updated 21 years, 9 months ago.
Viewing 2 reply threadsAuthorReplies-
WSjscher2000
AskWoody LoungerAugust 4, 2003 at 5:30 am #699393You want something like
If Spam Score > 51 Then Delete Message?
I don’t think this is an option through the Rules Wizard, which basically offers simple string matching in the message header. Depending on the range of values, you could look for a number of strings that would attempt to accomplish most of the same thing. Not the most efficient approach.
You could try a Visual Basic for Applications (VBA) solution. To read the message header using VBA requires an extended MAPI library such as Redemption, because Outlook doesn’t normally give you access to the message headers using Outlook’s built-in programming model. Unless someone’s already built this, it seems like a lot of work.
If you give us a little more background on the header info maybe you will get some more promising suggestions.
-
ibe98765
AskWoody PlusAugust 4, 2003 at 5:56 am #699400This is what the field looks like:
X-Text-Classification: K9spam [97.7%]
Obviously the 97.7% number can vary.
This is from a spam trap program that I have been having very good success with K9 (http://keir.net/k9.html). It’s free/donateware. It only works with POP3 email servers and is Bayesian based.
I get around 100+ emails a day and most of them are spam. K9, as you can see below, is catching 98.5% of the spam. Actually, the number is over 99% recently (the 98.5% number is averaged over a longer time period). Compared to the last spam program I used, this requires almost no maintenance or tweaking. I have setup a whitelist and my blacklist has all of 2 rules.
K9 forwards all emails to Outlook. I use a rule looking for the header field above and route the spam to a folder. But all I do then is go to the folder, Ctrl-A to select them all and then delete them all. But since Robin at K9 just added the % spam statistic, I thought I might be able to automate a bit and maybe auto delete anything with say , a figure over 90%. And also maybe route something with a lower spam % value to another folder (though K9 is rarely wrong).
—————————————————
Since 5/26/2003 12:00:00 AM
Total number of emails processed 7,472
Number of Good emails processed 1138
Number of Spam emails processed 6,334
Percentage of emails that matched whitelist rules 10.1%
Percentage of emails that matched blacklist rules 0.4%
Number of emails re-classified to Good 4
Number of emails re-classified to Spam 173
Percentage emails misidentified as Spam (false positives) 0.1%
Percentage emails misidentified as Good (false negatives) 2.3%
Overall accuracy 97.6%Since 7/4/2003 12:09:18 AM
Total number of emails processed 3,471
Number of Good emails processed 462
Number of Spam emails processed 3,009
Percentage of emails that matched whitelist rules 8.8%
Percentage of emails that matched blacklist rules 0.8%
Number of emails re-classified to Good 3
Number of emails re-classified to Spam 50
Percentage emails misidentified as Spam (false positives) 0.1%
Percentage emails misidentified as Good (false negatives) 1.4%
Overall accuracy 98.5% -
WSjscher2000
AskWoody Lounger -
ibe98765
AskWoody Plus -
ibe98765
AskWoody Plus -
ibe98765
AskWoody PlusAugust 4, 2003 at 10:33 pm #699721I tried to create a rule that would permanently delete a message (if it was rated at 100% likely hood of spam). This will happen when one of my blacklist rules are hit in K9. Mother Microsoft won’t let me do a permanent delete for some reason unless I stop processing more rules. Hmph! Where’s the logic in this restriction?
Apply to message
with “X-Text-Classification: K9spam [100” in the message header
permanently delete it
and stop processing more rules -
WSjscher2000
AskWoody Lounger -
ibe98765
AskWoody PlusAugust 5, 2003 at 1:31 am #699748OK, I’ll try it. I thought it meant no more messages would be processed. I did some searching and finally found this reference on the MS website (didn’t find anything in the Outlook help file):
“To avoid multiple rules operating on the same message, especially if you don’t want the bottom-most rule to prevail when multiple rules apply, select stop processing more rules as an action”.
-
ibe98765
AskWoody Plus -
ibe98765
AskWoody PlusAugust 8, 2003 at 7:01 pm #700895Well, almost working OK.
This rule:
Apply to message
with “X-Text-Classification: K9spam [100” in the message header
permanently delete it
and stop processing more rulesoccasionally generates the following error messge
Rules in error
X-Text-Classification: K9spam [100 You don’t have appropriate permission to perform this operation.When this error occurs, the rule is turned off and the error message sticks on my screen. Most of the time it works without issue. Any idea why this error is occuring and what to do about it?
-
WSunkamunka
AskWoody Lounger -
ibe98765
AskWoody Plus -
WSHansV
AskWoody LoungerAugust 9, 2003 at 8:50 am #700991You asked[indent]
Is there a quote function somewhere around here that I am missing?
[/indent]Yes, put
before and
after the text to be quoted. You can also insert the tag pair from the 1-Click TagPanel by clicking QUO, then paste or type the text to be quoted between the tags. See Help 19
-
ibe98765
AskWoody PlusAugust 9, 2003 at 6:08 pm #701035[indent]
You asked
——————————————————————————–
Is there a quote function somewhere around here that I am missing?
——————————————————————————–Yes, put
before and
[/indent] after the text to be quoted. You can also insert the tag pair from the 1-Click TagPanel by clicking QUO, then paste or type the text to be quoted between the tags. See Help 19
I’m trying this now. So you still have to manually copy the text first? Sure would be easier if there were a simple QUOTE button to click like in Innvision Power Board forum software. Could a button be added to this software?
-
WSHansV
AskWoody LoungerAugust 9, 2003 at 6:26 pm #701037Questions and suggestions about the Lounge software can be posted in the Lounge Matters forum.
I don’t know if the Lounge Administrators would welcome the possibility to quote an entire post with one click. Some posts are pretty long, and there is little sense in quoting them in their entirety. Quoting the relevant sentence(s) is more useful, and that takes copying and pasting.
If you would like to practice a bit more, use the Test forum.
-
ibe98765
AskWoody Plus -
WSunkamunka
AskWoody Lounger -
WSjscher2000
AskWoody Lounger -
ibe98765
AskWoody Plus
-
-
-
-
ibe98765
AskWoody PlusSeptember 2, 2003 at 7:04 am #709079Apparently, you can now use (limited) VBA in Outlook. So might be able to do IF-Then-Else logic. But Outlook doesn’t support the full object model, so there are lots of gotchas.
How to Create a Custom Rule Using Visual Basic for Applications
http://support.microsoft.com/default.aspx?…kb;en-us;235852ibe98765
AskWoody PlusSeptember 2, 2003 at 7:04 am #709080Apparently, you can now use (limited) VBA in Outlook. So might be able to do IF-Then-Else logic. But Outlook doesn’t support the full object model, so there are lots of gotchas.
How to Create a Custom Rule Using Visual Basic for Applications
http://support.microsoft.com/default.aspx?…kb;en-us;235852Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Migrating from win10 to win11, instructions coming?
by
astro46
27 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
2 minutes ago -
Recommended watching : Mountainhead movie
by
Alex5723
12 hours, 47 minutes ago -
End of support for Windows 10
by
Old enough to know better
10 hours, 6 minutes ago -
What goes on inside an LLM
by
Michael Covington
4 hours, 46 minutes ago -
The risk of remote access
by
Susan Bradley
2 hours, 52 minutes ago -
The cruelest month for many Office users
by
Peter Deegan
9 hours, 26 minutes ago -
Tracking protection and trade-offs in Edge
by
Mary Branscombe
15 hours, 1 minute ago -
Supreme Court grants DOGE access to confidential Social Security records
by
Alex5723
21 hours, 38 minutes ago -
EaseUS Partition Master free 19.6
by
Alex5723
8 hours, 48 minutes ago -
Microsoft : Edge is better than Chrome
by
Alex5723
1 day, 10 hours ago -
The EU launched DNS4EU
by
Alex5723
1 day, 23 hours ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
1 day, 13 hours ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
2 days, 5 hours ago -
Set default size for pasted photo to word
by
Cyn
2 days, 11 hours ago -
Dedoimedo tries 24H2…
by
Cybertooth
1 day, 23 hours ago -
Windows 11 Insider Preview build 27871 released to Canary
by
joep517
3 days, 10 hours ago -
Windows 11 ad from Campaign Manager in Windows 10
by
Jim McKenna
1 day, 2 hours ago -
Small desktops
by
Susan Bradley
3 hours, 34 minutes ago -
Totally disable Bitlocker
by
CWBillow
2 days, 3 hours ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
3 days, 7 hours ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
4 days, 13 hours ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
2 days, 8 hours ago -
Mystical Desktop
by
CWBillow
4 days, 17 hours ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
3 days, 22 hours ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
1 day, 9 hours ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
5 days, 8 hours ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
5 days, 11 hours ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
5 days, 9 hours ago -
What is wrong with simple approach?
by
WSSpoke36
3 days, 7 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.