A python script to export selected (HTML-) email files to kindle .mobi.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What is notmuch-to-kindle?

notmuch-to-kindle is small tool to transfer notmuch emails to Kindle in mobi format, using calibre’s utility programs (most importantly ebook-convert).

It currently extracts all mime parts, post-processes some (at this time, only .html and .doc, future versions will support epub as well), and copies all acceptable files (.mobi, .azw, .pdf) to your chosen Kindle search path.

.doc is converted via html through abiword. If it is missing, notmuch-to-kindle will output an error to stderr and proceed, ignoring the attached file.

If an email has both a text/plain and a text/html part, the HTML part will be extracted and exported to .mobi. If it only has a text/plain part, it will be extracted and copied without further conversion.


  • Calibre’s command-line tools (ebook-convert, ebook-device).
  • Python notmuch bindings.


On invocation the program will look for the ~/.notmuch-to-kindlerc file, which should contain something like this:


These are all the options available. Target specifies the ebook-device target to copy the finished files to, max is how many files to copy (max), and tag is the tag used to mark the emails to export from notmuch.

What doesn’t work yet?

  • Some attachments with unicoded file names won’t be extracted, because of a failure having to do with RFC2231. Email.utils.decode_rfc2231 won’t work, for some reason. I believe this to be a bug in Python. Suggestions welcome.