]> git.notmuchmail.org Git - notmuch-wiki/blob - postfixdovecottips.mdwn
News for release 0.38.3
[notmuch-wiki] / postfixdovecottips.mdwn
1 [[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
2
3 Postfix can be used for delivering mail and Dovecot for making your maildir
4 available using IMAP.
5
6 Dovecot Pigeonhole Sieve can be used for filtering incoming mail and index it
7 using notmuch.
8
9 [[!toc levels=2]]
10
11 # Configuration
12
13 ## Configure Postfix to use Dovecot Sieve
14
15 Set `mailbox_command` to dovecot deliver:
16
17         postconf -e 'mailbox_command=/usr/libexec/dovecot/deliver -f "$SENDER" -a "$RECIPIENT"'
18
19 ## Configure Dovecot Sieve to allow running notmuch
20
21 * Add `mail_plugins = sieve` to `/etc/dovecot/conf.d/15-lda.conf` to enable Sieve
22 * Add `sieve_plugins = sieve_extprograms` to `/etc/dovecot/conf.d/90-sieve.conf` to allow running external programs
23 * Add `sieve_extensions = +vnd.dovecot.pipe` to `/etc/dovecot/conf.d/90-sieve.conf` to allow pipe to external programs
24 * Add `sieve_pipe_bin_dir = /usr/libexec/dovecot/sieve-pipe` to `/etc/dovecot/conf.d/90-sieve-extprograms.conf` to configure directory with allowed programs
25 * Add `mail_location = maildir:~/Maildir` to `/etc/dovecot/conf.d/10-mail.conf` to use Maildir
26 * Run `mkdir /usr/libexec/dovecot/sieve-pipe` to create the directory with allowed programs
27 * Run `ln -s /usr/bin/notmuch /usr/libexec/dovecot/sieve-pipe/notmuch` to add a link to notmuch to the directory with allowed programs
28
29 ## Example Sieve configuration
30
31 Create `~/.dovecot.sieve` with the following contents:
32
33         require ["fileinto", "vnd.dovecot.pipe"];
34         if header :contains "X-Spam-Flag" "YES" {
35             pipe "notmuch" [ "insert", "--folder=.spam", "--create-folder", "+spam" ];
36         } elsif anyof (header :matches "From" "notmuch@notmuchmail.org") {
37             pipe "notmuch" [ "insert", "--folder=.mailinglist", "--create-folder", "+mailinglist" ];
38         } else {
39             pipe "notmuch" [ "insert", "+notmuch-insert", "+inbox" ];
40         }
41
42 # Notes
43
44 ## Postfix file size limit
45
46 Postfix sets a `file size` ulimit before executing the `mailbox_command`. This
47 also affects the notmuch index. Make sure `mailbox_size_limit` is at least the
48 size of your largest notmuch index files.