Hi
I picked up the small skript "checkattach" from Noel G. Mistula and
modified to do "Subject:" type filtering.
Do the following:
1. Install the script in /usr/local/bin.
2. chmod +x checksubj
3. Add this skript into your user's .qmail files and - if applicable - into
/var/qmail/alias/.qmail-default (first line:)
|/usr/local/bin/checksubj
~/Maildir/
etc.
4. Modify the subject text fields in "checksubj" to your needs, eg. add
"|*insurance*". The script evaluates the string case sensitive! It allows
wildcards, but be carefull!
5. The sender becomes the E-Mail bounced.
6. You can watch the results (and test the script) viewing your Maillog.
cheers.
eh.
#!/bin/sh
#
# qmail -- checksubj
# Author: Dr. Erwin Hoffmann - FEHCom
# Date: 2000-06-02
# Version: 0.1
#
# I use this in a user's .qmail file
# by adding the line
# |/usr/local/bin/checksubj
# before the ./Maildir/
#
printsubj () {
echo "Your E-Mail was rejected is because it contained a Subject like: $SUBJECTLINE."
echo "Sorry, we don't accept those E-Mails."
}
checksubject () {
case $SUBJECTLINE in
I-LOVE-YOU|ASSURANCE)
printsubj $SUBJECTLINE
exit 100;;
*)
;;
esac
}
SUBJECT=`(grep "Subject: " | awk -F: '{print $2}')`
for SUBJECTLINE in $SUBJECT
do
checksubject $SUBJECTLINE
done
exit 0
+-----------------------------------------------------------------------+
| fff hh http://www.fehcom.de Dr. Erwin Hoffmann |
| ff hh |
| ff eee hhhh ccc ooo mm mm mm Wiener Weg 8 |
| fff ee ee hh hh cc oo oo mmm mm mm 50858 Koeln |
| ff ee eee hh hh cc oo oo mm mm mm |
| ff eee hh hh cc oo oo mm mm mm Tel 0221 484 4923 |
| ff eeee hh hh ccc ooo mm mm mm Fax 0221 484 4924 |
+-----------------------------------------------------------------------+