Edit Gmail filters with XML


Gmail added a filter import/export feature recently that allows you to save and load filter data from XML. The cool thing about this is that it allows you to create and manage a whole heap of filters in text format and then import them all at once. Matt Thommes explains the procedure:

Here is the XML structure for a new filter item:

<title>Mail Filter</title>
<apps:property name=’from’ value=’joe@site.com’/>
<apps:property name=’label’ value=’Web’/>

Here we are setting up a filter to capture incoming email from joe@site.com, and applying a label of “Web.” Just like the Gmail process of setting up new filters, you can apply as many labels as you want, as well as other directives, such as sending directly to Trash:

<apps:property name=’shouldTrash’ value=’true’/>

Check Matt’s blog entry and the Gmail Labs discussion forum for more examples on how to use this.

Maintaining Gmail filters with XML
New in Labs: Filter import/export
Filter Import/Export Discussion Forum

Discuss this article with the rest of the community on our Discord server!