Offlineimap with notmuch and dovecot

Rainer M Krug r.m.krug at
Mon Dec 3 13:51:20 GMT 2012

Hash: SHA1

Thanks a lot for your information - very useful.



On 28/11/12 22:01, Ryan Kavanagh wrote:
> On Sun, Nov 25, 2012 at 05:14:40PM +0100, Rainer M Krug wrote:
>> 1) I have setup dovecot in the default settings, and the mail dir is located in ~/Maildir. It
>> is per default using maildir++. - is this correct?
> Sure, just set your .notmuch-config accordingly. So, in your case, assuming your username is
> 'rainer', you would have the following stanza in ~/.notmuch-config :
> [database] path=/home/rainer/Maildir
> notmuch is the only thing that really cares about where your mail is.
>> 2) I would like to configure offlineimap so that it b) syncs the gmail account into a
>> *subfolder* in my local imap account. The reasoning is that I can then move messages from the
>> GMAIL folder into a second folder (e.g. Archive) so that they are archived locally and
>> removed from the GMAIL account.
> You can do this using offlineimap. Add a nametrans in your remote Gmail stanza, and
> folderfilder and nametrans in your local Gmail stanza. I do this for example in for the
> QueensU, McGill, and McGillSOCS accounts in the offlineimaprc I linked to previously. For
> example, my McGill setup looks like:
> | #### McGill mail | [Account McGill] | localrepository = LocalMcGill | remoterepository =
> RemoteMcGill <snip> | | [Repository RemoteMcGill] <snip> You'll want something like this next
> line, whenever it copies a folder from the remote server to local IMAP, it prefixes that
> folder with "McGill." | nametrans = lambda foldername: 'McGill.' + foldername | | [Repository
> LocalMcGill] <snip> You'll want something like this next line, which only copies local folders
> starting with "McGill." to the remote server. | folderfilter = lambda folder:
> folder.startswith('McGill.') And the following line removes the prefix "McGill." when copying
> the local folder to the remote server. | nametrans = lambda folder: re.sub('^McGill.', '',
> folder)
> Please see my .offlineimaprc for the full version.
>> I could however have one imap account which is synched via offlineimap and a second local
>> imap account for local archiving? Then: How could I set this up via dovecot?
> Don't :) Just put everything under a subfolder. As you said, it's cleaner, and scales easily.
> For historical reasons, I have all of my GMAIL folders under my root folder, but each
> subsequent account gets its own folder. I can make sure that each account only syncs its
> respective folders using the above.
> Let me know if you have any more questions.
> Best wishes, Ryan

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys.

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at

Skype:      RMkrug
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the OfflineIMAP-project mailing list