Create an Apple Mail rule that contains two conditionals or applies a condition to a single mail box

How do I create a rule that applies two conditions like either of the following:


1. Delete mail that meets these two conditions: a.) older than 14 days & b.) from a list of sender addresses listed...


or


2. Delete mail that meets these two conditions: a.) older than 14 days & b.) contained in mailbox named "mailbox_A"


Device: Mac mini

MacOS: 14.3.1

Application: Apple mail

Feature: Rules

Mac mini (M2, 2023)

Posted on Feb 9, 2024 11:30 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 9, 2024 6:01 PM

The older than criteria would only trigger if you run the rule manually. Rules only automatically run on new messages arriving in the inbox.


Just click the Add button in the criteria list to add more criteria.

Any is an OR condition.

All is an AND condition.

Use rules to manage emails you receive in Mail on Mac - Apple Support


7 replies
Question marked as Top-ranking reply

Feb 9, 2024 6:01 PM in response to dbuchanan

The older than criteria would only trigger if you run the rule manually. Rules only automatically run on new messages arriving in the inbox.


Just click the Add button in the criteria list to add more criteria.

Any is an OR condition.

All is an AND condition.

Use rules to manage emails you receive in Mail on Mac - Apple Support


Feb 10, 2024 6:06 PM in response to dbuchanan

About your statement:
"Rules only automatically run on new messages arriving in the inbox."

This doesn't appear to be the case in my experience. Or, am I misunderstanding you in some way.

I don't know what you are observing. That's how it works. Rules run automatically on the inbox on incoming messages. It doesn't run on the entire inbox.

Here is what I've observed:
After creating the rule (and after each edit adding new a condition)
all messages, no matter their age, are were moved to the 'subscriptions' mailbox.

You set it to Any so that is an OR condition. If any of the criteria matches, it will move it to the Subscriptions mailbox.

It won't do a compound binary test, i.e., you can't OR a list the different addresses AND exclude by date. You can craft Smart Mailboxes to sometimes accomplish that. See below.

About your suggestion:
"Just click the add button in the criteria list to add more criteria."
It appears to be a bit more complicated than adding criteria to the rule.

Here's why:
1. The goal is to delete messages older than 14 days. So, the condition would be:
"Date received | is greater than | 14 | days old"

Again, this would only be possible if you run the rule manually. All messages collected by the rule would be received now.

This is insufficient for the reasons below

2. The action to perform also needs to change:
a.) "Move Message | to mailbox: | 'Subscriptions'"
b.) changes to: "Delete Message"
(Now this is an entirely new rule but that's not the problem).

I've seen posts that indicate sometimes the mailboxes used for move disappear when you save the rule. I can't help with that. Your issue sounds similar, but I'm not sure.

3. It's the CONDITION statement gums up the works. Using either "ANY" or "ALL" present serious problems:

Yes. I noted that above.


The problems are illustrated below in the two alternative structures.


The rule with the ANY (OR) condition:
(Yielding undesirable results - Because ANY older messages in any mailboxes meeting any condition are deleted)
=+=+=+=+=+=+=+=+=+=+=+=+
If ANY of the following conditions are met:
From | is equal to | email at washingtonpost dot com
From | is equal to | nytdirect at nytimes dot com
Date received | is greater than | 14 | days old
Perform the following actions:
Delete Message
=+=+=+=+=+=+=+=+=+=+=+=+


The rule with the ALL (AND) condition:
(No Action taken - Because ALL conditions are tested against each and every message)
=+=+=+=+=+=+=+=+=+=+=+=+
If ALL of the following conditions are met:
From | is equal to | email at washingtonpost dot com
From | is equal to | nytdirect at nytimes dot com
Date received | is greater than | 14 | days old
Perform the following actions:
Delete Message
=+=+=+=+=+=+=+=+=+=+=+=+

Make a smart mailbox that includes all of the addresses you wish to collect.

Use All

Date Received is not in the last 14 days

message is in mailbox <Subscription Smart Mailbox>

Feb 10, 2024 11:16 AM in response to Barney-15E

Barney-15E,

Thank you so much for your reply.


For clarity here is the basic structure of the existing rule:

=+=+=+=+=+=+=+=+=+=+=+=+

If ANY of the following conditions are met:

From | is equal to | email at washingtonpost dot com

From | is equal to | nytdirect at nytimes dot com

... (many more conditions)

Perform the following actions:

Move Message | to mailbox: | 'Subscriptions'

=+=+=+=+=+=+=+=+=+=+=+=+


About your statement:

"The older than criteria would only trigger if you run the rule manually."

Running a rule manually is completely acceptable. Setting up a way to do this is the entire issue.


About your statement:

"Rules only automatically run on new messages arriving in the inbox."


This doesn't appear to be the case in my experience. Or, am I misunderstanding you in some way.


Here is what I've observed:

After creating the rule (and after each edit adding new a condition)

all messages, no matter their age, are were moved to the 'subscriptions' mailbox.


About your suggestion:

"Just click the add button in the criteria list to add more criteria."

It appears to be a bit more complicated than adding criteria to the rule.


Here's why:

1. The goal is to delete messages older than 14 days. So, the condition would be:

"Date received | is greater than | 14 | days old"

This is insufficient for the reasons below


2. The action to perform also needs to change:

a.) "Move Message | to mailbox: | 'Subscriptions'"

b.) changes to: "Delete Message"

(Now this is an entirely new rule but that's not the problem).


3. It's the CONDITION statement gums up the works. Using either "ANY" or "ALL" present serious problems:


The problems are illustrated below in the two alternative structures.



The rule with the ANY (OR) condition:

(Yielding undesirable results - Because ANY older messages in any mailboxes meeting any condition are deleted)

=+=+=+=+=+=+=+=+=+=+=+=+

If ANY of the following conditions are met:

From | is equal to | email at washingtonpost dot com

From | is equal to | nytdirect at nytimes dot com

Date received | is greater than | 14 | days old

Perform the following actions:

Delete Message

=+=+=+=+=+=+=+=+=+=+=+=+



The rule with the ALL (AND) condition:

(No Action taken - Because ALL conditions are tested against each and every message)

=+=+=+=+=+=+=+=+=+=+=+=+

If ALL of the following conditions are met:

From | is equal to | email at washingtonpost dot com

From | is equal to | nytdirect at nytimes dot com

Date received | is greater than | 14 | days old

Perform the following actions:

Delete Message

=+=+=+=+=+=+=+=+=+=+=+=+


SUMMARY as I see it:

From all I've seen and tried there appears to be no way to either:

a.) Apply the delete criteria against a list of senders (i.e. "Washington Post", "New York Times", ..).

b.) Or apply the delete criteria against only messages in the 'Subscriptions' mailbox


Unless I'm missing something I think we're back at my original question.

Feb 11, 2024 7:42 AM in response to Barney-15E

I don't know what you are observing. That's how it works. Rules run automatically on the inbox on incoming messages. It doesn't run on the entire inbox.

Here's what I observe and how it happened for me:

  • The day I created the rule I had received only 21 messages from the list of senders.
  • However, after creating the rule it moved 5,854 messages into my brand new "Subscription" mailbox.
  • The messages span in age from received that day all the way back to four years ago.


At first I was confused on how rules worked in Apple Mail. I come from Microsoft Outlook.


After making the rule I only saw one new message added to the mailbox. I thought it either stopped or only worked on incoming messages. I looked in the menu and saw: Message > Apply Rules. I clicked that. Later, maybe or maybe not having anything to do with using the menu I noticed there to be over a thousand messages in the mailbox and still later all nearly 6,000 that are there now. That is my experience.


I'd be interested in how you get your rule to only operate against new mail. You have the rather straight forward configuration of the rule I'm using.


Make a smart mailbox that includes all of the addresses you wish to collect.
Use All
Date Received is not in the last 14 days
message is in mailbox <Subscription Smart Mailbox>


I did as you suggested.

Here's a description of my results, an observational note and the construction of my Smart Mailbox:


Using All - Returns an empty set

(Observational Note: empty because ALL = AND and sender can't be Washington Post AND New York Times)

=+=+=+=+=+=+=+=+=+=+=+=+

Smart Mailbox Name: Old Subscriptions

Contains messages that match ALL of the following conditions:

From | is equal to | email at washingtonpost dot com

From | is equal to | nytdirect at nytimes dot com

Date received | is not in the last | 14 | days

=+=+=+=+=+=+=+=+=+=+=+=+


Then I changed ALL to ANY.

Here's a description of my results, an observational note, and the construction of my Smart Mailbox:


Using ANY - Returns all my mail not in the last 14 days from every mailbox that I have an account for configured within Apple mail - About 23,000 messages - representing the size of all my mailboxes minus 14 days

(Observational Note: Based on the number of messages in 'Subscriptions' and the number added per day - If the Smart Mailbox would let me put an AND in front of the date CONDITION the set would contain about 5,500 messages.)

=+=+=+=+=+=+=+=+=+=+=+=+

Smart Mailbox Name: Old Subscriptions

Contains messages that match ANY of the following conditions:

From | is equal to | email at washingtonpost dot com

From | is equal to | nytdirect at nytimes dot com

Date received | is not in the last | 14 | days

=+=+=+=+=+=+=+=+=+=+=+=+


It looks like there's no solution available within Apple Mail - Neither Rules nor Smart Mailbox has a way to:

a.) Apply the delete criteria against a list of senders (i.e. "Washington Post", "New York Times", ..).

b.) Or apply the delete criteria against only messages in the 'Subscriptions' mailbox


Unless you have any other ideas I think I need to send feedback to Apple requesting a way to have more options in these tools.

Feb 13, 2024 5:15 PM in response to Barney-15E

Thank you for this clarification. I understand things better but I still need a bit more clarification.


When creating a rule it asks [Don't Apply] or [Apply] to indicate if one wants to apply the rule to only new mail or all mail. (I didn't really see where one is asked if is to be configured "manually" unless I don't understand what that means.


My observation and related question is: The selection one makes doesn't create the rule with any visible differences so how would one know the configured behavior of the rule without remembering or without performing some sort of investigation of the results? After all contents of mail can be very voluminous and complex.

Feb 13, 2024 6:37 PM in response to dbuchanan

When creating a rule it asks [Don't Apply] or [Apply] to indicate if one wants to apply the rule to only new mail or all mail. (I didn't really see where one is asked if is to be configured "manually" unless I don't understand what that means.

When you initially create a rule, it asks you one time if you want to apply it to the Inbox. That is the only time it will ask. After that, it will run automatically on new messages that come into the Inbox. It will not run automatically on any other mailbox. If you want to run it on any mailbox, including the Inbox, you can Apply Rules.

My observation and related question is: The selection one makes doesn't create the rule with any visible differences so how would one know the configured behavior of the rule without remembering or without performing some sort of investigation of the results?

As I described above, it's not asking you to "configure" the rule in any way. It is just asking you if you want to apply it to the inbox such that it runs against all messages currently in the inbox. It will never run automatically on all of the messages in the inbox, only the new messages.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Create an Apple Mail rule that contains two conditionals or applies a condition to a single mail box

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