Setting RULES with more than one condition in MS OUTLOOK

Status
Not open for further replies.

Abdullah

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
When setting rules, Outlook only gives you the option to check specific words in the body of an email....but uses the "OR" statement. If I want to specify 5 criteria that needs to be checked as "and" and not "or", how do I that in Microsoft Outlook?
The current problem is that when you set 5 criteria, if one criteria is met, then whatever rule you have set is proved true and activates the rule. I want 5 criteria and each must be true before the rule activates.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Rules are OR'd within the same condition and AND'd if you use different conditions.
From Billy or Sue AND subject contains the word Hello.

if you want to find mail sent to Billy and Sue, you would need to use a view or search folder, both of which have a better filter.
 

Abdullah

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Thank you Diane...I am setting up a rule in Outlook....not a search pattern...
I need to filter an email response on 5 criteria "specific words within the body"...but all it does is use "or" as the operator rather than "and"...and so my email filter fails if one of the conditions is met....I want all 5 criteria within the same condition to be true...why does Outlook not have this? Clearly from your answer, it does not...so what is an alternative way that I can do this? I am not a programmer or understand all the fancy VB routines...can you help?
 

Forum Admin

Senior Member
I have no idea why it's not in it - rules were added back in the Outlook 2000 time frame and haven't really changed much since, save for adding more conditions and actions. They haven't edited any existing conditions.

I'm not sure if a run a script rule would be efficient but there is at least one rules replacement utility that might work - auto-mate.

Can't pass up an interesting macro idea. :) This worked for me in a simple test. If all words in the array are anywhere in the body, it popped up the dialog box. If one word was missing, it did not.

If you have a specific condition in addition to the words in the body, look for that in the rule - if there are no other conditions, put one of the words in the rule, so the script processes fewer messages.

The only actions should be in this script.
More info: http://www.slipstick.com/outlook/rules/outlooks-rules-and-alerts-run-a-script/

Code:
Sub CheckForAll(Item As Outlook.MailItem)
    Dim strID As String
    Dim strTest As String
    Dim arr As Variant
    Dim objMail As Outlook.MailItem
    
    strID = Item.EntryID
    Set objMail = Application.Session.GetItemFromID(strID)
' Set up the array
arr = Array("outlook", "work", "key3")
' Go through the array and look for a match, then do something
For i = LBound(arr) To UBound(arr)
    If InStr(1, LCase(objMail.Body), arr(i)) = 0 Then
    Exit Sub
    End If
Next i

' do whatever
MsgBox "All Match"

Set objMail = Nothing
End Sub
 

Abdullah

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Thank you so much Diane...you are getting me to a solution very fast....so the purpose of my rule is...for an incoming email with a specific wording in the subject line (I got this part under control) , if true, then check if the following headers appear in the body of the email (In the code that you included to your reply, how do I use what you have sent me for my purpose..., where/how do I edit for my purpose.)

Company name
Name of sender
Telephone number
Landline number
Physical Address


If all true, then have server reply etc...(I have this part under control)
 
Status
Not open for further replies.
Top