This shows you the differences between two versions of the page.
qmail_and_procmail_how_to [2010/04/13 23:31] k2patel |
qmail_and_procmail_how_to [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Qmail and Procmail How To ====== | ||
- | |||
- | ==== qmail wrapper to check each mail ==== | ||
- | |||
- | <code sh | /usr/local/bin/qproc-wrap.sh> | ||
- | #!/bin/sh | ||
- | |||
- | # original modified, taken from http://openwall.info/wiki/internal/email/qmail-procmail | ||
- | |||
- | /var/qmail/bin/preline /usr/local/bin/procmail /usr/local/etc/procmail.rc && exit 0 | ||
- | |||
- | # check if procmail returned EX_TEMPFAIL (75) | ||
- | [ $? -eq 75 ] && exit 111 | ||
- | |||
- | # do we want to discard the message? | ||
- | [ $? -eq 99 ] && exit 99 | ||
- | |||
- | # otherwise return a permanent error | ||
- | exit 100 | ||
- | </code> | ||
- | |||
- | ==== Define procmail rules ==== | ||
- | |||
- | <code sh | /usr/local/etc/procmail.rc> | ||
- | SHELL=/bin/sh | ||
- | #LOGFILE=/tmp/procmail.log | ||
- | #VERBOSE=yes | ||
- | |||
- | :0h | ||
- | *^X-Spam-Status: Yes | ||
- | /usr/local/vpopmail/domains/test.com/spammer/Maildir/new | ||
- | |||
- | # deliver the message normally | ||
- | EXITCODE=0 | ||
- | # | ||
- | |||
- | # this line needs to be here | ||
- | # or else all mail will get double delivered to Maildir | ||
- | # and to /var/mail/vpopmail, slowly filling /var | ||
- | :0 | ||
- | /dev/null | ||
- | </code> | ||
- | |||