Postfix in combination with spamassassin and procmail
- procmail is called by postfix: this should be set in ../postfix/main.cf
mailbox_command = /opt/procmail/bin/procmail -a "$EXTENSION" (or wherever procmail is located) - In the case, that postfix (or another mailer) does not call procmail directly:
create a $HOME/.forward with a line like:
"|IFS=' ' && p=/opt/procmail/bin/procmail && test -f $p && exec $p -Yf- || exit 75 loginname"
- necessary information are stored in $HOME/.procmailrc, for example:
VERBOSE=yes
LOGFILE=$HOME/log
LOGABSTRACT=all
MAILDIR=$HOME/Mail
# pipe all mails to spamassassin which are smaller then 356000 bytes
# to server reduce load we use a spamc/spamd combination
:0fw: spamassassin.lock
* < 256000
| spamc
# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "probably-spam".
:0:
* ^X-Spam-Status: Yes
probably-spam
# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped. This will re-add it.
:0
* ^^rom[ ]
{
LOG="*** Dropped F off From_ header! Fixing up. "
:0 fhw
| sed -e '1s/^/F/'
}
If the mails after filtering should be forwarded to another account, replace [:0] with [:0c], otherwise the delivering is completed.