[PATCH] Syncing gmail labels for gmail accounts
abdo.roig at gmail.com
Wed Nov 28 12:48:02 GMT 2012
> 1) Am I right that, when I pull the git repo, that setup.py will
> install the patched offlineimap?
Yes, the offlineimap fork on https://github.com/aroig/offlineimap is the
current OI master branch + the patches on this thread. The setup.py
installs the patched version.
The man page and sample config is updated, so you can find some info there.
> 2) How does a .offlineimaprc look when using your patch? Do I have to
> sync all folders or only the [GMAIL] folders which are "real" imap
> folders and contain all emails and no duplicates?
Well, you will be fine syncing only the folder "[Gmail]/All Mail" (or
whatever it is called for your account as the name is localized...).
This is how I use it. I have one big "All Mail" folder with all the mail
(even sent mail). Then I have my local Maildir indexed by mu , and
use mu4e  as email client. With this setup I can search very fast,
filter by label, etc. like on the web interface.
The only small drawback is that mu4e is not able to change labels, so I
wrote a little script, to do that, and integrated it with mu4e. You
could also use formail  for this I guess.
Syncing additional label folders should work just fine with the patch,
if you want to do this. However, you will end up with message duplicates
on your disk and sort of defeats the purpose of the patch.
There are a couple of exceptions were it may be useful to sync the
actual IMAP folder.
[Gmail]/Drafts, is associated to the special label '\Drafts' (there are
some special labels beginning with '\' that gmail gives special
treatment [4,5]). I do sync the drafts folder, because my mail client
uses the local Drafts folder to store... well, drafts, and then they get
synced back to gmail.
Also, [Gmail]/Trash is related to the special label "\Trash" and has
special status on the gmail side. When you move a message there, it
really goes to the actual gmail trash and it will be deleted after some
time. Also deleting a message from Trash makes it go away. Deleting a
message from All Mail has no effect (it just reappears on the next
If it helps, I attach a commented version of my offlineimaprc.
> 3) I assume it is a sync, i.e. that changes in the labels in the
> X-headers locally get synched back to gmail?
Yes, it is a two way sync, just like flags.
First propagates labels from gmail to local. For this compares labels on
gmail with the ones from the last sync (this is stored on a database in
~/.offlineimap by default) and propagates whatever has changed, adding
or removing labels.
Then it does the same thing from local to gmail.
> I would be very happy to test your patch and to give feedback.
Thanks! I'd suggest you make backups of the following before testing:
* the maildir you are syncing
* offlineimap's cached data which by default is on the directory
~/.offlineimap. This is not essential, as if it were lost,
offlineimap would rebuild it without data loss, but it could take
If you are currently using offlineimap with your mail collection, the
data on ~/.offlineimap should be automatically updated to the new
format, so you don't need to worry about that. If there were problems,
though, it is safe to just remove ~/.offlineimap and let it be
recreated. Either way, the first time will be slow because it must add
the labels to every message in the maildir.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the OfflineIMAP-project