This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

Procmail is available at:http://www.procmail.org/. Procmail is often installed as the default LDA. A simple system wide Procmail Maildir configuration looks like this:

# file: /etc/procmailrc
# system-wide settings for procmail
SHELL="/bin/bash"
SENDMAIL="/usr/sbin/sendmail -oi -t"
LOGFILE="/var/log/procmail.log"
DEFAULT="$HOME/Maildir/"
MAILDIR="$HOME/Maildir/"
:0
* ^X-Spam-Status: Yes
.spam/

Procmail delivers mails into Maildir folders, if a slash is appended to the folder name (e.g. ".spam/"). But Procmail itself could not update the Dovecot index files. This decreases the performance a bit, because the Dovecot IMAP or POP3 server has to add new mails for the index files.

To increase the performance, it's possible to combine Procmail with Dovecot's deliver tool:

# file: /etc/procmailrc
# system-wide settings for procmail
SHELL="/bin/bash"
SENDMAIL="/usr/sbin/sendmail -oi -t"
LOGFILE="/var/log/procmail.log"
DELIVER="/usr/lib/dovecot/deliver"
# Use the following if you get "destination user parameter (-d user) not given":
DROPPRIVS="YES"
# fallback:
DEFAULT="$HOME/Maildir/"
MAILDIR="$HOME/Maildir/"
:0 w
* ^X-Spam-Status: Yes
| $DELIVER -m spam
:0 w
| $DELIVER

CAVEAT:

On a Debian system at 2010-04-04 I found that the delivery wasn't working with an error of "Fatal: destination user parameter (-d user) not given" If I add the following line to the /etc/procmailrc file it fixes the problem: DROPPRIVS=yes It seems the deliver program from Dovecot 1.2 expects a -d parameter if it is run as root, rather than the user that the delivery is being done for.

Lenny Update

On Debian Lenny I had a couple of problems. For historic reasons, I have inboxes in /var/mail/$USER. The most elegant approach was to add the auth master socket in the dovecot configuration, then chmod 1777 /var/mail (root/mail) and use this procmail file:

# file: /etc/procmailrc
# system-wide settings for procmail
SHELL="/bin/bash"
SENDMAIL="/usr/sbin/sendmail -oi -t"
LOGFILE="/var/log/procmail.log"
DELIVER="/usr/lib/dovecot/deliver"
:0 w
| $DELIVER -d $LOGNAME

None: procmail (last edited 2012-06-15 22:41:05 by c-66-31-136-134)