Procmail: Difference between revisions

From Hackepedia
Jump to navigationJump to search
Feel free to add different filters to the example
 
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Procmail is an autonomous mail processor.
Procmail is an autonomous mail processor.


It can be invoked at the individual user level simply by placing the following text inside of [[Variables|$HOME]]/.forward  
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"
  "|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  
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:
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/
  CLEAN=${HOME}/.maildir/
Line 14: Line 14:
  LOGFILE=${HOME}/.maillog
  LOGFILE=${HOME}/.maillog
  DEFAULT=$MAILDIR
  DEFAULT=$MAILDIR
  # This places any emails To or Cc *jposel" into the ether.
  # This places any emails To or Cc *gwbush* into the ether.
  :0:
  :0:
  * ^(To|Cc):.*jposel*
  * ^(To|Cc):.*gwbush*
  /dev/null
  /dev/null
  # The following are examples for a few popular mailing lists, in which it will
  # The following are examples for a few popular mailing lists, in which it will

Latest revision as of 14:08, 21 February 2006

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/