Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Create Mail rule that combines "all" and "any"

I would like to create a rule for Apple Mail that combines "all" and "any".

I need to create a rule where I have a group of "any" criteria, "Message content contains X" OR "Message content contains Y" (and potentially some more ...) but I would like this to only apply to one of my email accounts, so the condition "Account is iCloud" must always be met. Somehow along those lines



Specifically, I would like to create a rule that is only valid for a specific account, and filters messages from either Sender A, or sender B, or C, or D, etc ...

So I need one "and" (all) conditions and a number of "or" (any) conditions.


The action I would then want to attach is to move the matching messages to a designated "On my Mac" mailbox/folder and deleting them from the respective IMAP folder.


I was even thinking if there was a way to combine two rules, like rule A has all the "any" conditions and then I make a new "all" rule B that filters messages that match rule A and are in account X. But I couldn't figure out a way to do it.

Any suggestions?

Posted on Apr 27, 2019 6:04 AM

Reply
Question marked as Best reply

Posted on Apr 27, 2019 6:42 AM

You can't combined Any or All conditions in a single rule. You will have to create 2 separate rules to accomplish what you want. Rules are acted upon in the order of the list. So be careful which rule is first as to what you want to accomplish.


Similar questions

5 replies

Apr 27, 2019 7:10 AM in response to jandavid

Each rule you make which would have to include different criteria like a specific account combined with other criteria will have to execute on it's set perimeters. If it meets all the conditions, then the actions will execute. If you have no Stop Evaluating as an action, rules after it could change the first rules action.

Rule 2 would have to contain it's own criteria.


So each rule would have to specify all conditions and would have to include the account you want and the other criteria to act upon. You will have to create a rule like that for every criteria and include the account as criteria.


If you are only applying rules to this one account only and not to the others, you could create the first rule with Any condition and Selecting add each account to the criteria (other than the one you want rules for) and put a Stop Evaluating Rules action. Afterwards, the only account rules would be applied to would be the one in question and you won't have to specify that as criteria. Then, you could create the single rule with ANY of the specific criteria, unless a certain criteria would require a different action than the others.

Apr 27, 2019 7:33 AM in response to Glenn Leblanc

Hmm, thank you for your suggestions.


Your first suggestion, creating a rule for every criteria and include the account as criteria is not feasible as I have about 20 criteria (like 20 email addresses, and if the message is from "any" of them I'd want to execute an action) so in this case I'd need to create 20 rules, which is a bit overkill.


Your second suggestion seem like it might work. But I do also want to create rule for the other accounts. But if I place those rules before the "Stop Evaluating Rules" for "any" of the other accounts rule, it should still work, right?


I was also thinking of using an AppleScript to attach it to a rule for all messages from Account X, which before executing an action would do some more filtering for senders (or whatever) for me. But I'm not very proficient with AppleScript and can't seem to find good documentation/examples...




Apr 27, 2019 7:45 AM in response to jandavid

Yes, you could create rules for other accounts first and use the Stop Evaluating at the end of those. Order in the list is key. And if you don't want further action to a specific rule after it's action is met, then include the stop evaluating rules with it also as an action. That would be fine and easy to do.


As for AppleScript, I don't mess with it and it would probably be easier to do what you want with the rules. Just give it a bit of thought and you should be able to make it work.

Create Mail rule that combines "all" and "any"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.