procmail
[Top] [All Lists]

Re: Rejecting unknown users

2001-02-07 15:16:34
On Wed 2001/02/07 14:55:49 EST, Postmaster 
<allemail(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us> 
writes:
I have been playing around with it all day, but have run into a snag. When I
use the following recipes, everything gets rejected. All the high school
students usernames begin with 01,02,03, or 04. I want to trash any username
that begins with those characters, and then let through anything with
@kenton.k12.oh.us (which would presumable be the teachers). The
.localprocmailrc is for future use, where I can list addresses of allowed
senders for individual students.

I have the following .procmailrc:

#Preliminaries
SHELL=/bin/sh               #Use the Bourne shell (check your path!)
MAILDIR=${HOME}/mail            #First check what your mail directory is!
LOGFILE=${MAILDIR}/procmail.log
LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "
PMDIR=/etc/procmail

#System Wide
INCLUDERC=${HOME}/.localprocmailrc
INCLUDERC=$PMDIR/reject.rc
INCLUDERC=$PMDIR/accept.rc
INCLUDERC=$PMDIR/trash.rc

Here is the reject.rc:
#Reject High School Students
:0
* ^From*(01|02|03|04)*
| (formail -rk \
        -A "X-Loop: MAIL-REJECTION" \
        -A "Precendence: junk"; \
        echo "This e-mail account is restricted on";\
        echo "who it can receive e-mail from and has";\
        echo "not received this message.";\
        echo " ";\
        echo "If you believe this to be in error, please";\
        echo "notify postmaster(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us" ) | 
$SENDMAIL -t -oi

Here is my accept.rc:
#Accept from KCS Teachers
:0:
* ^From*(_at_)kenton\(_dot_)k12\(_dot_)oh\(_dot_)us
${DEFAULT}

Your from conditions are probably not what you want you are looking for 
lines starting with "Fro" followed by 0 or more 'm'.  You probably wanted 
"^From:[        ]*(01|02|03|04)" (there is a space and a tab inside the []) or 
"^From:.*(01|02|03|04)[a-z]*@" (a-z should be replaced with whatever 
characters are valid after the 0[1-4] for your high school students) and 
"^From:(_dot_)*(_at_)kenton\(_dot_)k12\(_dot_)oh\(_dot_)us".

And finally my trash.rc:
# Trash all others with a reply.
:0
* !^FROM_DAEMON
* !^FROM_MAILER
* !^X-Loop: MAIL-REJECTION
| (formail -rk \
        -A "X-Loop: MAIL-REJECTION" \
        -A "Precendence: junk"; \
        echo "This e-mail account is restricted on";\
        echo "who it can receive e-mail from and has";\
        echo "not received this message.";\
        echo " ";\
        echo "If you believe this to be in error, please";\
        echo "notify postmaster(_at_)kenton(_dot_)k12(_dot_)oh(_dot_)us" ) | 
$SENDMAIL -t -oi

It looks to me like everything was being picked up by this rule since the above 
weren't matching.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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