If I have multiple filters that match the same email do they all get processed? If so, in what order are they processed? What if the first filter matched modifies the email to make it match (or no longer match) a different filter?
7 Answers
I just tried it, and it seems that they happen in the order they are defined in the list:
If you have:
- Star email message
from:foo - Apply label to
is:starred
... then it will apply the label to the message. If you reverse the order, it won't.
- 8The caveat is that when you have multiple filters that skip the inbox, filters are processed in order but each mail is subject to all the filters before it is processed.blee– blee2012-08-28 17:19:28 +00:00Commented Aug 28, 2012 at 17:19
I have two filters, A and B, and two labels, A and B. If filter A is applicable to an email then I wanted label A to be applied to the email and for that email to skip the inbox and be archived.
I also want to do the same thing with filter B, but I don't want label B to be applied if label A has been applied.
It turns out this can be done.
In filter B adjust the filter so it reads
-label:[FilterA] AND [ rest of filter B ]. This will cause filter B to by bypassed if label A has been applied.Make sure filter B is listed AFTER filter A in the list. If this is not the case just open filter B and re-save it.
Note that Gmail may throw up a message about using "label" as a filter is not recommended because it cause the filter to not be applied to any incoming messages. I just ignored it, this seemed to work.
- 2Awesome, this is what I wanted to know!Hiro2k– Hiro2k2016-03-20 09:51:46 +00:00Commented Mar 20, 2016 at 9:51
- 1If there are multiple possible labels that could be applied and you only want one of them, a generalization of this is to do
has:nouserlabels AND <whatever else>. E.g. I filter emails from my school into many categories and then have a catch-all for anything elsefrom:(school.edu) AND has:nouserlabels. Just make sure that any labels that should take higher priority occur earlier in the list.Nathan– Nathan2019-03-19 17:25:41 +00:00Commented Mar 19, 2019 at 17:25
The only exception to bbodiens comment (I was just about to post almost exactly the same answer!!) is that one would expect a 'marked as read' and 'archived' message to essentially skip further filtering, but this is not the case.
To test this i set up two test filters, one that labels incoming mail with the subject 'testing' as test1 and archives it, and a second filter on 'testing' that labels test2.
The mail was archived AND labeled twice, so it appears that filters are concurrent.
- 2Bad test and incorrect conclusion -1Dan Rosenstark– Dan Rosenstark2010-11-29 20:58:18 +00:00Commented Nov 29, 2010 at 20:58
- 2I find that my filters are concurrent as well .. @Yar, can you explain how to avoid this?farinspace– farinspace2013-08-19 14:56:04 +00:00Commented Aug 19, 2013 at 14:56
- @farinspace isn't there a thing on the filters to "not process further filters" or something?Dan Rosenstark– Dan Rosenstark2013-09-18 16:21:58 +00:00Commented Sep 18, 2013 at 16:21
- @Yar I would love to know where I can find that setting.sxu– sxu2014-02-20 17:27:50 +00:00Commented Feb 20, 2014 at 17:27
- @sxu there's no way to do that, unfortunately, it turns out. The filters all apply, sequentially, unless something moves to the trash.Dan Rosenstark– Dan Rosenstark2015-03-17 21:59:39 +00:00Commented Mar 17, 2015 at 21:59
Any and all GMail filter rules that match will run and do their thing.
I'm not sure it's possible to create rules that potentially conflict. The filter criteria available are:
- From
- To
- Subject
- Containing words
- Doesn't contain words
- Has attachment
You can't affect any of these with the filter actions that are available, so I don't see how one rule could run and then affect the message in a way that would stop it matching another filter that it would have previously matched.
- 2you can add a label to a message and have a filter which uses
label:, see this question.Senseful– Senseful2010-07-07 22:25:33 +00:00Commented Jul 7, 2010 at 22:25 -
From Gmail help:
Fun fact: these actions will take place in the order they're listed -- for example, you could choose to Forward matching messages to a specific email address, then Delete the messages.
- 6This "fun fact" is not about the order of multiple filters, but about the order of multiple actions within the same filter. It does appear that the filters are processed in the order listed, but the documentation does not say that.user79865– user798652015-08-02 17:26:24 +00:00Commented Aug 2, 2015 at 17:26
- -1. As @NormalHuman noted, this "answer" doesn't answer the question.2015-08-04 02:26:43 +00:00Commented Aug 4, 2015 at 2:26
I think these two filters in this order will cause the email to remain in the inbox:
- If
From:[email protected]then "Skip the Inbox". - If
From:@bar.comthen "Never send it to Spam".
- Even though this answer is a bit off-topic, thanks for putting it here. I ran into this exact non-intuitive behavior.dpb– dpb2014-12-12 18:16:25 +00:00Commented Dec 12, 2014 at 18:16
- Anyone know a workaround to this? Is it just a matter of reversing the order of the filters?Simon East– Simon East2023-08-08 07:35:49 +00:00Commented Aug 8, 2023 at 7:35
If you have several filters, which each have as action to apply a label, then all the labels for all the matching filters will be applied to the email.
- This doesn't address what happen "if the first filter matched modifies the email to make it match (or no longer match) a different filter"Patrick Bard– Patrick Bard2024-08-06 04:37:10 +00:00Commented Aug 6, 2024 at 4:37