Exim4 + Maildir + Procmail on Debian etch mini-HOWTO

What is Procmail? From Wikipedia (http://en.wikipedia.org/wiki/Procmail):

Procmail is a mail delivery agent (MDA) or mail filter, a program to process incoming emails on a computer, widely used on Unix systems. It is typically invoked from an MTA like Sendmail; this makes the mail processing event-driven. The companion-tool formail allows procmail to be used in batch-processing on mail that already is in your mailbox.

Common operations carried out with procmail include filtering and sorting of emails into different folders according to keywords in from, to, subject, text of the mail, or sending autoreplies, but more sophisticated operations are also possible.

A common practice is to let procmail call an external spam filter program, such as SpamAssassin. This method can allow for spam to be filtered or even deleted.

We can combine Procmail with Exim4, filter mail with some extra rules, and deliver incoming mail into other location. Working this on Debian etch is not too difficult.

First of all, we will need the Procmail package (you usually have this already):

apt-get install procmail

Then we will need the /etc/procmailrc, which defined the rules that will be apply. We can use the example as references:

cat /usr/share/doc/procmail/examples/3procmailrc  > /etc/procmailrc

NOTICE!! This sample is target for mailbox format, and so we will need to take the following changes for Maildir support:

MAILDIR =       $HOME/Maildir/  # You'd better make sure it exists
DEFAULT =       $MAILDIR
#LOGFILE =      $MAILDIR/from
LOCKFILE=       $HOME/.lockmail

By default, Exim4 will route incoming mail to procmail if /etc/procmailrc exists, and transport it though procmail_pipe. you don't need to take extra handling for this ;-)


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i> <sup> <acronym> <pre> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.