Procmail

From Hackepedia
Jump to navigationJump to search

Procmail is an autonomous mail processor.

It can be invoked at the individual user level simply by placing the following text inside of $HOME/.forward

"|exec /usr/local/bin/procmail || exit 75"

note the above must include the absolute path to procmail. After that, now you can begin the fun by creating a .procmailrc Here is a sample .procmailrc that assumes you're using Maildir format instead of mbox, and your Maildir folder is $HOME/.maildir/:

CLEAN=${HOME}/.maildir/
PATH=/usr/bin:/bin:/usr/local/bin:.
MAILDIR=${HOME}/.maildir/
LOCKFILE=${HOME}/.lockmail
LOGFILE=${HOME}/.maillog
DEFAULT=$MAILDIR
# This places any emails To or Cc *gwbush* into the ether.
:0:
* ^(To|Cc):.*gwbush*
/dev/null
# The following are examples for a few popular mailing lists, in which it will
# place the content into the folder prefixed with .
:0:
* ^Sender:.*yashy-hack@mail\.yashy\.com
.yashy-hack/
:0:
* ^(To|Cc):.*nmap-hackers@insecure\.org
.nmap-hackers/
:0:
* ^Subject:.*Politech*
.politech/
# Garbage filtering
# B = Body 
:0
* ^Content-Type: multipart/alternative
* B ?? ^Content-Type: (audio/x-|application).*;.*$.*name=.*\.(scr|com|bat|pif|lnk|exe)$
.klez/
:0
* ^Content-Type: multipart/mixed
* B ?? ^Content-Type: (audio/x-|application).*;.*$.*name=.*\.(scr|com|bat|pif|lnk|exe)$
.yaha/
# This is if size is greater than
:0
* > 98400
.bigfile/