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;235852 -
ibe98765
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;235852
Viewing 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
-
24H2 has suppressed my favoured spider
by
Davidhs
2 minutes ago -
GeForce RTX 5060 in certain motherboards could experience blank screens
by
Alex5723
7 hours, 41 minutes ago -
MS Office 365 Home on MAC
by
MickIver
1 hour, 30 minutes ago -
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
21 hours, 44 minutes ago -
Flash Drive Eject Error for Still In Use
by
J9438
23 hours, 17 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
1 day, 16 hours ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
1 day, 16 hours ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
20 hours, 16 minutes ago -
Migrate off MS365 to Apple Products
by
dmt_3904
21 hours, 4 minutes ago -
Login screen icon
by
CWBillow
11 hours, 27 minutes ago -
AI coming to everything
by
Susan Bradley
11 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
2 days, 8 hours ago -
No Screen TurnOff???
by
CWBillow
2 days, 8 hours ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
2 days, 9 hours ago -
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
2 days, 20 hours ago -
How well does your browser block trackers?
by
n0ads
2 days, 7 hours ago -
You can’t handle me
by
Susan Bradley
5 hours, 52 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
1 day, 23 hours ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
3 days, 8 hours ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
2 days, 11 hours ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
3 days, 8 hours ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
3 days, 8 hours ago -
Lumma malware takedown
by
EyesOnWindows
2 days, 20 hours ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
3 days, 17 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
3 days, 17 hours ago -
Meet Gemini in Chrome
by
Alex5723
3 days, 21 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
3 days, 21 hours ago -
Trump signs Take It Down Act
by
Alex5723
4 days, 5 hours ago -
Do you have a maintenance window?
by
Susan Bradley
2 days, 10 hours ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
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.