The post from artlung has the right idea (the easiest way to do this is to edit the filters as XML), but the XML code he posts actually does not do what the original poster requested. The original poster requested to have a single filter that applied two different labels. That is, the original poster wanted to apply two labels to the same email message, identified by the same criteria. (This requirement is implicit in his screenshot showing the "one label" limitation in Gmail after you have selected a set of filtering criteria. It is also what I happened to need today.) The post by artlung applies the_label
to messages from foo@example.com
and another_label
to messages from bar@example.com
. In other words, it applies one label to messages from one person and a different label to messages from another person. The requirement is really to apply both labels to messages from the same person.
You might think that code like this would work:
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<content></content>
<apps:property name='from' value='foo@example.com'/>
<apps:property name='label' value='the_label'/>
<apps:property name='label' value='another_label'/>
</entry>
But you would be mistaken. When you import XML like that above into Gmail, the first label assignment (the_label
) will be silently dropped, and you will wind up with a filter that only assigns another_label
. You have to do as artlung suggests and have two separate blocks. However, to get the intended effect, the two blocks would need to have the same trigger (matching criterion), like this:
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<content></content>
<apps:property name='from' value='foo@example.com'/>
<apps:property name='label' value='the_label'/>
</entry>
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<content></content>
<apps:property name='from' value='foo@example.com'/>
<apps:property name='label' value='another_label'/>
</entry>
Perhaps this much is obvious and implicit in artlung's answer. The main piece of new information I am adding is that the "two labels in one filter" solution does not work, even in XML. I tested it, and as I noted, you only get the second label. I would have posted this as a comment, but I don't have the rep.