Offlineimap with notmuch and dovecot

Ryan Kavanagh rak at
Wed Nov 28 21:01:36 GMT 2012

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 :


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
| [Repository RemoteMcGill]
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]
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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1876 bytes
Desc: Digital signature
URL: <>

More information about the OfflineIMAP-project mailing list