[[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
# Software working with Maildir and Notmuch
## **Mail storage formats**
Notmuch can index any mail that is stored as singular files in directory structure.
Here are some popular formats used.
### **Maildir**
This is the native mail storage format for notmuch.
In addition to indexing mail content notmuch can synchronize standard maildir flags with notmuch tags. See [[special-tags]].
[Original specification](http://cr.yp.to/proto/maildir.html), for extensions see below.
There are slight differences on how to handle the `new` subdirectory.
While the definition specifies it's for freshly-delivered mail before adding flags only, some software (notably mutt) use it for all unread mail even after the flags were added to filenames.
### **NNTP Spool**
As NNTP uses incrementing number for each message in a newsgroup those are often used for filenames in NNTP software.
Notmuch can index mail stored like this, but flag synchronization is unavailable and mail-reading software that expects maildir might not work with it.
### **MH folders**
This is structured very much like NNTP Spool with numbered messages in a directory.
Above statements apply.
## **Notmuch frontends**
Have a separate [[wiki page|frontends]].
## **Mail fetchers and synchronizers**
Name |
Bidirectional |
Protocol |
Keywords/tags |
More info |
offlineimap |
yes |
IMAP4 |
standard-only? |
- |
muchsync |
yes |
custom |
notmuch database |
- |
dsync |
yes |
IMAP4/POP3/custom |
dovecot format |
|
mbsync/isync |
yes |
IMAP4 |
standard-only |
- |
getmail |
no |
IMAP4/POP3 |
no |
- |
fetchmail |
no |
IMAP4/POP3 |
no |
no maildir support, can deliver to SMTP or local MDA |
imapfw |
yes |
IMAP4 |
? |
work in progress |
lieer |
tags: yes, mail: fetch |
GMail |
bi-directional tag |
Fast email-fetching and two-way tag synchronization between notmuch and GMail written using GMail API and Notmuch Python |
Other links of interest:
* [mswatch](http://mswatch.sourceforge.net/) Triggers sync on mailbox changes.
* [mailsync](http://mailsync.sourceforge.net/) Based on UW library that doesn't support Maildir out of the box. MH folders are supported.
* [imapsync](http://imapsync.lamiral.info/) (unidirectional)
* [slrnpull](http://slrn.sourceforge.net/docs/slrn-FAQ-5.html) Fetches NNTP newsgroups (such as USENET or Gmane) into numbered spool format which notmuch can index.
## **Filters and mail delivery agents**
Mail delivery agent (or MDA for short) is a piece of software that performs the
final step of mail transfer: saving it into user's mailbox.
This is invoked either by SMTP server (MTA), mail fetcher, or chained from
other delivery agent to perform such tasks as mail filtering, saving to
different folders, or forwarding to different addresses.
Following software can deliver to Maildir mailboxes:
* [procmail](http://www.procmail.org/)
* Courier (or standalone): [maildrop](http://www.courier-mta.org/maildrop/)
* Dovecot: [dovecot-lda](http://wiki.dovecot.org/LDA)
* Postfix: [local](http://www.postfix.org/local.8.html)
* Exim: [appendfile](http://exim.org/exim-html-current/doc/html/spec_html/ch-the_appendfile_transport.html#SECTmaildirdelivery)
* Qmail: [qmail-local](http://qmail.org/man/man8/qmail-local.html)
* OpenSMTPD: supports tuning via [.forward](https://man.openbsd.org/forward) files
Many MDAs also support filtering via [Sieve](https://en.wikipedia.org/wiki/Sieve_%28mail_filtering_language%29) language.
## **IMAP servers**
Internet Mail Access Protocol servers that can interoperate with notmuch.
It is of note that IMAP protocol supports storing so-called [keywords](https://tools.ietf.org/html/rfc3501#page-11) (user-defined flags) which are mostly equivalent to notmuch tags.
Unfortunately Maildir does not have standard way to encode keywords, so there are extensions necessary to store that information.
### **Dovecot**
[Homepage](http://dovecot.org/) | [Maildir extensions](http://wiki.dovecot.org/MailboxFormat/Maildir)
The fully standard-compliant IMAP server.
Has efficient syncing and multimaster replication capability.
Up to 26 different keywords can be stored per-maildir using Maildir flags a-z.
Their meaning is defined via `dovecot-keywords` file which is simple, well-defined text file which maps each letter to specific tag/keyword.
If more than 26 keywords appear in one Maildir then some of them are stored in [dovecot-specific](http://wiki.dovecot.org/Design/Indexes/MainIndex) [index files](http://wiki.dovecot.org/IndexFiles).
Dovecot's dsync will sync keywords into this format.
### **Courier**
[Homepage](http://www.courier-mta.org/) | [Maildir++ specification](http://www.courier-mta.org/maildir.html) | [Further Maildir++ specification](http://www.courier-mta.org/imap/README.maildirquota.html)
The origin of Maildir++ format which was also adopted by dovecot, among others.
Ships many useful commandline tools.
It stores keywords in [courierimapkeywords](http://www.courier-mta.org/imap/README.imapkeywords.html) inside the maildir.
It supports arbitrary amount of keywords, but unfortunately actually reading them is rather convoluted process.
### **Other**
* [UW-IMAP](http://www.washington.edu/imap/) supports MH folders and there is a patch for Maildir support.
* [Cyrus](http://www.cyrusimap.org/) has it's [own mailbox format](http://www.cyrusimap.org/docs/cyrus-imapd/2.5.7/internal/mailbox-format.php), but stores messages as single files which should be indexable.