Offline email syncing

with bonus email wrangling

December 30, 2020 — January 18, 2024

computers are awful
computers are awful together
concurrency hell
faster pussycat
plain text
Figure 1

Will never do for sending mail; that is too much work. I am sometimes happy to take a security hit by getting some email provider to do it for me; If the feds want to read my email they can do it there.

However, I might want to slightly reduce my risk profile by keeping my email offline and syncing locally. i.e. I might want to serve my mailboxes e.g. over IMAP, or even as local .mbox/Maildir/etc files. For more on that see email offline.

Once I have set this up, I could use a standard mail client or even run a local webmail client.

1 Replicated mail server


2 Offline sync/archiving

Can I sync files and IMAP?

2.1 isync

2.2 offlineIMAP

OfflineIMAP is a GPLv2 software to dispose your mailbox(es) as a local Maildir(s).

For example, this allows reading the mails while offline without the need for your mail reader (MUA) to support disconnected operations.

OfflineIMAP will synchronize both sides via IMAP.

2.3 Generic files

2.4 SQL

This feels like a stupid idea. Do a really need to run a generic server process to index a lot of files if they are mail? I can store a lot of non-mail documents as files and it works pretty well in the modern world.

Mailpiler is a webserver which provides a front-end to a MySQL index of all your emails. Is that what you want? Are you spending your time wisely?

Or get even fancier: mikegioia/libremail: IMAP ➝ SQL syncing engine, JavaScript-free email client, and a Kanban-style email client.

Without checking, I bet these two apps use distinct idiosyncratic SQL schemas to store the mail.

3 Incoming

3.1 notmuch

If you’ve been looking for a fast, global-search and tag-based email system to use within your text editor or in a terminal…

If you’re the kind of person that gets excited about being able to write shell scripts for exploring and manipulating your email…

If you’re a developer of an existing email program and would love a good library interface for fast, global search with support for arbitrary tags…

If you want the convenience of fast, reliable search of all your email, but don’t want to give a 3rd-party access to your email…

Then notmuch may be exactly what you’ve been looking for.

3.2 Jaromail

Jaro Mail is an integrated suite of interoperable tools to manage e-mail communication in a private and efficient way, without relying too much on on-line services, in fact encouraging users to store their email locally.

Rather than reinventing the wheel, Jaro Mail reuses existing free and open source tools working since more than 10 years (and likely to exist for longer) and is mainly targeted to Apple/OSX and GNU/Linux desktop usage.

4 Features

  • Minimalistic interface with automatic threading
  • Targets intensive usage of mailinglists
  • Does whitelisting and integrates addressbooks
  • Can do search and backup by expressions
  • Automatically generates filtering rules
  • Import and export of VCard contacts
  • Computes and shows statistics on mail traffic
  • Secure password storage (native OS keyring)
  • Provides advanced maildir management tools

Does what I want, sort of, except the seems to really want me to use a console-based mail app to read mails. I wonder if I can ignore that part?

4.1 maildir utils

With the enormous amounts of e-mail many people gather and the importance of e-mail messages in our daily work-flow, it is very important to be able to quickly deal with all that—in particular, to instantly find that one important e-mail you need right now.

For that, mu was created. mu is a tool for dealing with e-mail messages stored in the Maildir-format, on Unix-like systems. mu’s main purpose is to help you to find the messages you need, quickly; in addition, it allows you to view messages, extract attachments, create new maildirs, … See the mu cheatsheet for some examples. Mu’s source code is available in github, and there is the mu-discuss mailing list.

mu includes an emacs-based e-mail client (mu4e), a simple GUI (mug) and bindings for the Guile/Scheme programming language.

5 Features

  • fast indexing for Maildir, Maildir+ and Maildir-on-VFAT
  • search for messages based on the sender, receiver, subject, date-range, size, priority, words in message, flags (signed, encrypted, new, replied, has-attachment,…), message-id, maildir, tags, attachment (name, mime-type, text) and more
  • support for encrypted and signed messages
  • command-line tools for indexing, searching, viewing, adding/removing messages, extracting attachments, exporting/searching address lists, creating maildirs, …
  • accent/case normalization - so angstrom matches Ångström
  • can be integrated with other e-mail clients such as mutt and Wanderlust.
  • mu4e, an emacs-based e-mail client based on mu (see screenshot).
  • mu-guile: guile 2.0 bindings that allow for scripting, advanced processing of your data, and doing all kinds of statistics
  • fully documented (man pages, info pages)