Hi,
Below is my procmailrc file designed to discard all mail that is not from a
know source.
The known sources are kept in a file which I fgrep for matches. For the most
part, this script has been working well, however, once in a while (and I know
this is vague) fgrep seems to fail and a message that should pass through is
caught. I hoping some out there might know why. Any other comments about this
script also welcome.
Thanks in advance,
Spencer
# File: .procmailrc
# By: Spencer Marks <smarks(_at_)digisolutions(_dot_)com
# Last Updated:
#
# Purpose: This file contains a collection or procmail recipes that filters my
# mail. All mail coming from a source other than that listed in the
# a file called "known.senders" is deleted. (if no debugging is on)
# When a file is deleted, a copy is also returned to the sender with
a message
# explaining how to by-pass the filter.
#
#
# Set up some variables
MAILDIR=$HOME/Mail #you'd better make sure this directory exists
BYPASSWD=Mellon! # Password for users to bypass spam
filtering
ALTFROM=login(_at_)otherdomain(_dot_)com # Alternate "From" line for
autoreplies
NOLOOP=$ALTFROM # Variable to check for mailing loops when
# autoreplying -- leave as is.
SENDMAIL=/usr/lib/sendmail # Where the sendmail program
lives; not
part of standard path
FORMAIL=/usr/local/bin/formail # Where the formail program lives
NOLOOP=$ALTFROM #Variable to check for mailing loops when
#autoreplying -- leave as is.
ADMINFOLDER=$MAILDIR/admin.incoming #for bounced mail, mail from root,
postmaster, abuse
# Recipe for debugging.
# Sends a copy of all mail to alternate address
# Note: c: means process mail with this recipe and then pass it on.
# Normally, once a recipe is successfully other recipes aren't executed.
#:0 c:
#! spencer(_at_)ne(_dot_)highway1(_dot_)com
:0:
* $ ^X-Loop: ${NOLOOP}
/dev/null
# specific jerks get nuked here.
:0:
* ^From. xbiz(_at_)olsusa(_dot_)com
/dev/null
# Here is where we allow mail with the password the subject to pass through
:0:
* $ ^Subject:.*${BYPASSWD}
! smarks(_at_)ne(_dot_)highway1(_dot_)com
# Here is where we check incoming mail's address against approved list
# if address is on approved list, it's forwarded and no more recipes are
executed
# (Note: there is no c: present)
# !! for unknown reasons (to me at least) this fgrep fails when it shouldn't...
:1
? fgrep -i -f $HOME/known.senders
! smarks(_at_)ne(_dot_)highway1(_dot_)com
# Now we are getting ready to send a message to unknown users.
# First we copy the message into a temp file
:0 c:
caught.mail
# Now we are getting ready to send a message to unknown users.
# First we copy the message into a temp file
:0 c:
spamtemp
# next we lock the temp file and create a reply.
:0: spamtemp.lock
| ($FORMAIL -r \
-A"X-Loop: ${NOLOOP}";\
cat $HOME/unknown;\
cat $HOME/separatr;\
cat spamtemp;\
rm -f spamtemp) \
| $SENDMAIL -oi -t