GMail labels sync - what and how?

Abdó Roig-Maranges abdo.roig at
Tue Feb 10 10:07:03 GMT 2015


> I am looking for some information about the GMail label sync and how I
> can use the synched labels.

On the man page (under the heading USE CASES) there is an example of such

What this settings will do is sync the gmail labels into a special header
embedded into the email (it modifies the raw message for that).

Then you can use this extra data locally the way you want. Write scripts to
autotag messages, index your message and search for tags, etc.

One note of warning though, chose the header for the labels labels right the
first time. If you need to change it afterwards, you will have to move your
labels manually to the new header.

This choice depends on how you will use your labels locally. Some email clients
recognize X-Keywords (the default) some recognize X-Labels, and some simply are
not aware of it. The X-Gmail-Keywords written in the man page example is not
recognized by anybody, as far as I know.

> 0) Generally: What do I have to do to have my GMAil labels synched and how can
> I use them locally? Is there any information on the site? Do I
> have to use the GmailMaildir local backend

To sync them, you need to use GmailMaildir locally, yes, Gmail remotely, and set
synclabels = yes on the account section. Also configure the labelsheader right
for your use case. Look at the example on the man page.

> and notmuch to utilise these synced labels?

I'm not sure about notmuch. Notmuch keeps its own tags in the external index,
and some time ago it didn't know about X-Keywords or similar non-standard email
headers. I was a notmuch user, and moved away for exactly this reason. I wanted
the labels in the message, not in the index. I use mu4e now. I think mutt picks
up X-Keywords or X-Label, but I'm not sure, and have no idea about gnus.

> 1) I use dovecot as my local imap and sync all folders from gmail to
> dovecot (Even All Mail...). This gives me the possibility to do
> deletions, moving, tagging and so on from Gnus and have it synched back
> to GMail.

Well, several simplifications occur to me.

1. if you use an email client that handles well Maildir folders, you can get rid
   of your local dovecot.

   Also, if you plan on using labels, an email client that indexes your email,
   like notmuch or mu4e do, would improve things a lot. If you have tons of
   email with labels, but have no index, the labels will be quite useless. And
   for that you need to access the Maildir directly, not through dovecot.

2. If labels are in place, and your email is indexed, Then you can just sync
   "All Mail", and navigate your email via searches by label, like you do on

> Can this synching be simplified by synching e.g. only All Mail
> and have the emails put into multiple local imap folders if they have
> multiple tags?

The point of the label syncing is to get rid of the folders and use searches by
label, and this pretty much requires email indexing. If you are happy with the
"label-as-folders" thing from gmail's IMAP, then the label syncing stuff will
not give you much.

Abdó Roig.

More information about the OfflineIMAP-project mailing list