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.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.
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.
First of all, we will need the Procmail package (you usually have this already):
apt-get install procmail
/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:By default, Exim4 will route incoming mail to procmail if
MAILDIR = $HOME/Maildir/ # You'd better make sure it exists
DEFAULT = $MAILDIR
#LOGFILE = $MAILDIR/from
LOCKFILE= $HOME/.lockmail
/etc/procmailrc
exists, and transport it though procmail_pipe. you don't need to take extra handling for this ;-)
No comments:
Post a Comment