Last active
February 10, 2022 11:29
-
-
Save mmm/5961074 to your computer and use it in GitHub Desktop.
Quick and dirty Gmail filters. Work ported from procmail a couple of months ago...
Write out an xml file `erb filters.xml.erb > filters.xml` and import this into gmail Settings->Filters tab ("import filters" down at the bottom of the page).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding='UTF-8'?> | |
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'> | |
<title>Mail Filters</title> | |
<% MAILING_LISTS = [ | |
{ | |
:name => "canonical-com", | |
:pattern => :list, | |
:base_name => "lists.canonical.com", | |
:lists => [ | |
"canonical-allhands", | |
"canonical-announce", | |
#... | |
] | |
}, | |
{ | |
:name => "ubuntu-com", | |
:pattern => :list, | |
:base_name => "lists.ubuntu.com", | |
:lists => [ | |
"juju", | |
"juju-dev", | |
"ubuntu-announce", | |
#... | |
] | |
}, | |
{ | |
:name => "launchpad-net", | |
:pattern => :list, | |
:base_name => "lists.launchpad.net", | |
:lists => [ | |
"blueprint", | |
"buildd", | |
#... | |
] | |
}, | |
{ | |
:name => "launchpad-bugs", | |
:pattern => :bugs, | |
:lists => [ | |
"Admin", | |
"Assignee", | |
#... | |
] | |
}, | |
{ | |
:name => "wikimedia-org", | |
:pattern => :list, | |
:base_name => "lists.wikimedia.org", | |
:lists => [ | |
"labs-l", | |
"mediawiki-api-announce", | |
"wikitech-l", | |
#... | |
] | |
}, | |
{ | |
:name => "org", | |
:pattern => :list, | |
:base_name => "org", | |
:lists => [ | |
"austinonrails-austinonrails", | |
#... | |
] | |
}, | |
{ | |
:name => "rubyforge-org", | |
:pattern => :list, | |
:base_name => "rubyforge.org", | |
:lists => [ | |
"bdrg-members", | |
#... | |
] | |
}, | |
{ | |
:name => "ruby-lang-org", | |
:pattern => :list, | |
:base_name => "ruby-lang.org", | |
:lists => [ | |
"ruby-talk", | |
#... | |
] | |
}, | |
{ | |
:name => "googlegroups-com", | |
:pattern => :list, | |
:base_name => "googlegroups.com", | |
:lists => [ | |
"pecancommons", | |
"techranchers", | |
#... | |
] | |
}, | |
] %> | |
<% MAILING_LISTS.each do |list_group| %> | |
<% list_group[:lists].each do |list| %> | |
<% group_name = list_group[:name] %> | |
<entry> | |
<category term='filter'></category> | |
<title>Mail Filter</title> | |
<content></content> | |
<% case list_group[:pattern] | |
when :list %> | |
<apps:property name='hasTheWord' value='list:"<%= list %>.<%= list_group[:base_name] %>"'/> | |
<% else %> | |
<apps:property name='hasTheWord' value='Launchpad AND replyto:(@code.launchpad.net) OR replyto:(@bugs.launchpad.net) <%= list %>'/> | |
<% end %> | |
<apps:property name='label' value='<%= "#{group_name}/#{list}" %>'/> | |
<apps:property name='shouldArchive' value='true'/> | |
<apps:property name='shouldNeverSpam' value='true'/> | |
</entry> | |
<% end %> | |
<% end %> | |
</feed> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment