[gmailieer] fast fetch and two-way tag synchronization between notmuch and GMail

Gaute Hope eg at gaute.vetsj.com
Sun Mar 26 22:52:08 PDT 2017

Rafael Avila de Espindola writes on mars 27, 2017 4:32:
> I currently have a mbsync + notmuch setup and I am just about to give
> this a try.
> One question is what the notmuch setup should look like. I assume I
> should create a new config file pointing to the directory where the
> emails will be written to. Do I have to run notmuch setup to create the
> db?

Yes, it is a good idea to just back up your entire notmuch db and set up
a new one to test gmailieer with.

gmailieer respects $NOTMUCH_CONFIG and reads it to figure out which
'new' tags to add (no need to use inbox or unread here, that will only
create confusion - I only use 'new' to do tagging).

Assuming you want to set up a separate notmuch database to test you do
the following:

    get a client secret API key for gmailieer [0], you only need this
  during setup or if gmailieer needs to be re-authenticated. so store it
  somewhere safe, say: ~/.secret/client_secret.json. ideally this should
  be unnecessary [1].

# setting up a separate notmuch db
$ mkdir ~/test_mail/  # our new mail root
$ cd ~/test_mail
$ export NOTMUCH_CONFIG=$(pwd)/.notmuch-config
$ mkdir mail          # new mail database root
$ notmuch setup
  * specify ~/test_mail/mail as mail database
  * specify only 'new' as new tag
$ notmuch new         # create db
$ cd mail

NOTE: As long as you are using a non-standard notmuch config location make
sure that environment variable is set when using gmailieer.

# setting up gmailieer
$ mkdir gmail
  * this will be the gmailieer local repository.
  * it should be a sub-dir of the root mail db.
  * you can keep other mail (from other accounts) outside this
    gmailieer local repository.
$ cd gmail
$ gmi auth -c ~/.secret/client_secret.json
  * authenticate gmailieer, choose the correct account, say:
    charlie.root at gmail.com
$ gmi init -a charlie.root at gmail.com # gmailieer should now be set up
$ gmi pull # does the initial pull, fetching all you messages - this
           # could take some time.

When you want to synchronize your account you do:
$ gmi sync    # which effectively does gmi push; gmi pull

this will also update the notmuch database so it should not be necessary
to run 'notmuch new' afterwards.

Regards, Gaute

[0] https://console.developers.google.com/flows/enableapi?apiid=gmail
[1] https://github.com/gauteh/gmailieer/issues/1

More information about the notmuch mailing list