Entry
How can I setup a spammers file to delete matching spam mail automatically?
setting a spammers file to delete matching spam mail automatically for all users on the system?
Feb 24th, 2000 22:59
Nathan Wallace, deno vichas, Paul Jarc
One possible way to do this is by putting something like this at the
top of your ~/.qmail:
|grep -f .spammers &>/dev/null && exit 99; exit 0
If you don't already have a ~/.qmail, remember to add a line after
the above line to specify your normal delivery method; typically:
./Mailbox
(Read the dot-qmail man page for details about ~/.qmail, especially
the `SAFE QMAIL EDITING' section, lest some of your mail go astray.)
Then for any spammer's address, say, `spammer@flaky-biz.com', add a
line to ~/.spammers containing a regular expression to catch that
address (for help with regular expressions, read grep's man page):
^From:.*\<spammer@flaky-biz\.com
Now any mail that contains `spammer@flaky-biz.com' in the From: header
will disappear before you see it. Make sure ~/.spammers exists, or
else all your mail will disappear. If ~/.spammers is empty, all your
mail will be delivered as usual.
Remember that a message will be dropped if it matches *any* rule in the
spammer file; it doesn't have to match them all, and it doesn't have to
match both of a pair that are supposed to work together. If you want to
require that a message match each of a set of rules, you'd need a more
complicated regular expression, or a more complicated .qmail delivery
rule.
You can add other rules to the file, such as one for the subject line:
^Subject:.*\$\$\$