[notmuch] notmuch vs gmail filters

Subject: [notmuch] notmuch vs gmail filters

Date: Thu, 1 Apr 2010 18:01:16 +1000

To: notmuch@notmuchmail.org

Cc:

From: Anthony Towns


Hey *,

I'm currently using gmail for my mail and trying to port its behaviour
to notmuch. I had a go at writing a python script to convert my gmails
to notmuch tag commands along the lines of Carl's post [0]. It uses
the Gmail labs feature to export filters (to an XML file), and then
goes from XML stanzas like:

        <entry>
                <category term='filter'></category>
                <title>Mail Filter</title>
                <id>tag:mail.google.com,2008:filter:1270085835242</id>
                <updated>2010-04-01T05:33:40Z</updated>
                <content></content>
                <apps:property name='from' value='updates@linkedin.com'/>
                <apps:property name='label' value='flyers'/>
                <apps:property name='shouldArchive' value='true'/>
        </entry>

(which says to tag messages from updates@linked.com with "flyers" and
skip the inbox) into a notmuch command like:

    notmuch tag -inbox +flyers -- from:updates@linkedin.com '(' not
tag:flyers or tag:inbox ')'

The bit in brackets makes sure it doesn't tag messages that already
have exactly the right tags -- this coule probably be implied in any
invocation of notmuch tag really...

Anyway, attached. It converts gmail's list: match to a notmuch to:
match, and just gives up on deliveredto: matches. But maybe someone
else finds it useful/interesting too :)

Cheers,
aj

[0] id:87r5o8stbj.fsf@yoom.home.cworth.org

-- 
Anthony Towns <aj@erisian.com.au>

Thread: