hack your email with notmuch - gnu...hack scripts python notmuch = notmuch . database(mod=enotmuch ....

15

Upload: others

Post on 24-Sep-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

hack your email with notmuch

David Bremner

August 23, 2013

Page 2: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

What is notmuch?

A library/command-line tool for

indexing,

tagging, and

searching

a local email store, one message per �le.

Page 3: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

The notmuch �ecosystem�

Mail user agentsExample tools

Bindings

gmime xapian

notmuch CLI

libnotmuch

notmuch-emacs

alot

python

bower notmuch-web

notmuch-mutt

mutt_kznotmuch-vim

nmbug_status

ruby

afew nmbug

go

Page 4: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Bus factor 5?

Carl Worth

David Bremner

Austin Clements

Sebastian Spaeth

Jani Nikula

David Edmondson

Jameson Graef Rollins

Justus Winter

Bart Trojanowski

Dmitry Kurochkin

Mark Walters

Tomi OllilaPieter Praet

Michal SojkaAli Polatel

Felipe ContrerasPeter Wang

93 Others

Page 5: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

On the command line

Commands

notmuch count [options...] <search-term>...

notmuch dump [<filename> ] [--] [ <search-term>...]

notmuch search [options...] <search-term>...

notmuch show [options...] <search-term>...

notmuch tag +<tag>|-<tag> [...] [--] <search-term>...

Page 6: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

On the command line

Commands

notmuch count [options...] <search-term>...

notmuch dump [<filename> ] [--] [ <search-term>...]

notmuch search [options...] <search-term>...

notmuch show [options...] <search-term>...

notmuch tag +<tag>|-<tag> [...] [--] <search-term>...

Query Syntax

from:<name-or-address> to:<name-or-address>

subject:<word-or-quoted-phrase> attachment:<suffix>

tag:<tag> (or is:<tag>) id:<message-id>

thread:<thread-id> folder:<directory-path>

date:<since>..<until>

Page 7: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

On the command line

Query Syntax

from:<name-or-address> to:<name-or-address>

subject:<word-or-quoted-phrase> attachment:<suffix>

tag:<tag> (or is:<tag>) id:<message-id>

thread:<thread-id> folder:<directory-path>

date:<since>..<until>

% notmuch search tag:inbox::notmuch and to:david

% notmuch search --output=files tag:deleted | xargs rm

Page 8: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Emacs Based MUA

Talks to the CLI via sexp output

Thread based UI

Uses message mode to send mail

Support for MIME and OpenPGP

Page 9: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Options for Emacs haters

alot (python, curses)

notmuch-vim (vim, ruby)

Page 10: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

notmuch-mutt

�exports� notmuch searches to symlink farms

comes with con�guration snippet to integrate with mutt

Page 11: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Web client

Written in Haskellhttp://hackage.haskell.org/package/notmuch-web

Communicates with the CLI via JSON output

Page 12: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Hack scripts

Perl/CLI

my $notmuch = spawn ({} , ' |− ' ,qw/notmuch tag −−batch / ) ;

foreach my $ p a i r (@{ $ s t a tu s−>{added }}) {pr in t $notmuch

pa i r_to_batch_l ine ( $A_action , $ p a i r ) ;}

Python

notmuch = notmuch . Database (mode=notmuch . Database .MODE.READ_WRITE)

q = notmuch . Query ( db , qu e r y_s t r i n g )q . s e t_so r t ( notmuch . Query .SORT.OLDEST_FIRST)fo r m in q . search_messages ( ) :

th read_id = m. get_thread_id ( )

Page 13: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Hack scripts

Python

notmuch = notmuch . Database (mode=notmuch . Database .MODE.READ_WRITE)

q = notmuch . Query ( db , qu e r y_s t r i n g )q . s e t_so r t ( notmuch . Query .SORT.OLDEST_FIRST)fo r m in q . search_messages ( ) :

th read_id = m. get_thread_id ( )

Ruby

do_read do | db |q = db . que ry ( get_cur_view )q . s o r t = 0msgs = q . search_messagesmsgs . each do | msg |

m = Mai l . r ead (msg . f i l e n ame )pa r t = m. f i n d_ f i r s t_ t e x tnm_m = Message . new (msg , m)$messages << nm_m

Page 14: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

Not much of a bug tracker

Page 15: hack your email with notmuch - GNU...Hack scripts Python notmuch = notmuch . Database(mod=enotmuch . Database E.DOM.READ_WTERI) q = notmuch . Query(db , query_string ) q. set_sort

notmuch more info?

source/wiki http://notmuchmail.org

mailing list [email protected]

irc irc://chat.freenode.net/#notmuch