procmail
[Top] [All Lists]

Re: Filtering mail for all users centrally

1997-02-28 10:56:27
Hi all
New to procmail and this group.Will any one tell me how to filter out any
mail to any of my users having Subject field as "Junk" or From field as
"abc(_at_)xyz(_dot_)com"(i can do this one in sendmail but how to do this in
procmail).I do not want .procmailrc file or .procmail directory in any
individual user's home directory.I want to filter all mails using a
central file or files. (probably after defining procmail mailer in
sendmail).Is it possible to do the same arrangement for outgoing mails
 (with Subject: Junk) also.
Thanks in advance.
PKS

You can use /etc/procmailrc, which will be read before any individual
.procmailrc's if they exist.  Note 

Mine looks like the following and invokes a pile of rules in
/usr/local/etc/spamrc for the fun filters.

It isn't as far as I know possible to do the same with outgoing mail and I'm
not sure I would want to.  Local users that spam will get their accounts
deleted.  It's the remote spammers that bother me.

(The 'nospam' mailer is invoked on any address of the form
username(_at_)site(_dot_)cmc(_dot_)net, instead of just 
username(_at_)cmc(_dot_)net and I am a bad boy and
advertise a wildcard MX for *.cmc.net so a simple change to a news client to
post as username(_at_)news(_dot_)cmc(_dot_)net makes the filters come into 
play.)

#
# Procmail Antispam filter rules....

# argument is 'nospam' if this is for the spam filter.
ARGUMENT=$1
# ack!  give up root now!
DROPPRIVS=yes
 
# nospam mailer: recipient must be a visible To or Cc, and auto-filtered
# through the spamrc.
:0
* ? /usr/ucb/test x$ARGUMENT = xnospam
{
    EXITCODE=77
    #
    # Set up our To: and Cc:
    TOADDR= "^To: (_dot_)*$LOGNAME(_at_)(_dot_)*\(_dot_)cmc\(_dot_)net"
    CCADDR= "^Cc: (_dot_)*$LOGNAME(_at_)(_dot_)*\(_dot_)cmc\(_dot_)net"
 
    :0 
    * !$$TOADDR
    {
        # if we're not a To.... see if we're wanted it.
        :0 A
        * !$$CCADDR
        /tmp/spamtrap
    }
    INCLUDERC=/usr/local/etc/spamrc
}

# if user has selected filtering, do the spamrc.
:0
* ? /usr/local/bin/checkfilt c $LOGNAME
{
    INCLUDERC=/usr/local/etc/spamrc
}
 
EXITCODE=""

<Prev in Thread] Current Thread [Next in Thread>