procmail
[Top] [All Lists]

Re: Can someone please design/point me to a recipe that.....

1996-07-24 12:11:03
On Wed, 24 Jul 1996 01:04:57 -0500 (CDT), AIRWAVES MEDIA 
<rrb(_at_)clm(_dot_)aiss(_dot_)uiuc(_dot_)edu> said:

... maintains a database of addresses to KILL ALL MAIL FROM?

Summary:
  1. Put the junkmail.rc (shown below) in $MAILDIR
  2. Put the following line in your .procmailrc
         JUNKMAIL_EXITCODE=0
         INCLUDERC=junkmail.rc
  3. Put addresses in $MAILDIR/junkmail.data, one per line.

More details are at http://www.universe.digex.net/~mbr/unix/junkmail.html

Mike

--------- cut here ---------
### junkmail.rc - delete junk mail.
###
### JUNKMAIL_FILE is a list of regular expressions, one per line.
### Each is compared with the FROM address of the message and, if
### they match, the message is destroyed.  A log of destroyed
### messages is kept in JUNKMAIL_LOG.  By default the message is
### bounced back to the sender with a "no permission" message;
### to suppress this set JUNKMAIL_EXITCODE to 0 before including
### this file.
###
### Jul 13 1996 Mike Rose
### Jul 16 1996 Mike Rose  Ignore case of address

JUNKMAIL_FILE=${JUNKMAIL_FILE:-junkmail.data}
JUNKMAIL_LOG=${JUNKMAIL_LOG:-junkmail.log}
JUNKMAIL_EXITCODE=${JUNKMAIL_EXITCODE:-77}
FROM_ADDR=`formail -rtzxTo:`

### GNU egrep doesn't run out of memory after just a few
### meta-characters during "egrep -f".  SunOS egrep does.
EGREP=${EGREP:-egrep}

EXITCODE=$JUNKMAIL_EXITCODE

:0h: $JUNKMAIL_LOG$LOCKEXT
* $ ? test -s $JUNKMAIL_FILE
* ? echo "$FROM_ADDR" | $EGREP -i -f $JUNKMAIL_FILE
| echo "`date` : $FROM_ADDR : `formail -zxSubject:`" >> $JUNKMAIL_LOG

EXITCODE=0
--------- cut here ---------