Plesk 9 – procmail filtering with postfix through .qmail file
I have just migrated to Plesk 9.2.2 and there is now postfix instead of qmail, so my procmail rules stopped working. Fortunately Plesk changed the MTA but has left the way they filter email, so if you want to use procmail filtering on Plesk you can just copy your .procmailrc file to /var/qmail/mailnames/$DOMAIN/$MAILBOX and run following:
#!/bin/bash for PROCMAIL in `find /var/qmail/mailnames/ -maxdepth 3 -name .procmailrc`; do chown root: $PROCMAIL chmod 644 $PROCMAIL DIR=`dirname $PROCMAIL` FROM="/usr/bin/deliverquota \./Maildir" TO="/usr/bin/procmail -m -o HOME=$DIR $DIR/.procmailrc" sed -i $DIR/.qmail -e "s@$FROM@$TO@" done
And here just an example of .procmailrc file
SHELL=/bin/sh DIR=${HOME}/Maildir # Bayes 99% and spam including 20 points goes away :0 * ^X-Spam-Status:.*BAYES_99 * ^X-Spam-Level: ................... /dev/null # Bayes 99% spam is sure spam :0 * ^X-Spam-Status:.*BAYES_99 ${DIR}/.SpamBayes/
Categories: Missing Answers