procmail
[Top] [All Lists]

Re: Creating a "Don't Kill" file...

2001-01-09 23:23:20
At 20:56 2001-01-09 +0000, Simon Daykin wrote:
I am trying to create a don't-kill file.

Okay, so this ends up in the searchable archives with an appropriate keyword, let me mention "green list" and (less politically correct) "white list" as terms generally associated with what you're trying to accomplish.

but can't get it to work.
What I want to do is send all mail which isn't sent explicitly to me,
*except* those which have the from address listed in a text file.

Your grammar sucks <g>.  You want to send the mail where?  Trash, or forward?

#----Likely to be Spam!---
:0: $PMDIR/spam.lock
* !^TObyte-sized
* ! ?grep -s `formail -x 'From '` notspam.txt
! my_spam(_at_)hotmail(_dot_)com

This seems to work fine and filters out 99% of the spam I receive, however
it also filters out mails from mailing-lists. even the ones which have the
"from" address listed in the file "notspam.txt"

Without a very specific example of a failure, you're asking for random shots into the dark. Somebody is liable to get hurt.

Some possibilities:

        Perhaps because they do not match the inverted TO condition?

        The 'From ' header isn't guaranteed to be the same as the plain
        address you may be expecting to get mail from - that is, a mailing
        list might not match, or a specific user on a mailing list might not,
        because the From: you see and the From (envelope sender) can be very
        different.

        The 'From ' header also contains a datestamp - as coded, it looks
        like you're going to expect to match it WITH that included.

Surely you've enabled logging and examined the verbose log? This would provide you with a lot of clues.

The grep seems to work fine, if the mail is from a person in the notspam.txt
then the grep returns the name correctly and returns nothing if it isn't.
The problem seems to come from trying to invert the return from grep.

Try the following (note that this deals with the trailing datestamp on the From line):

:0h
* ^From[        ]+\/[^  ]*
NOTJUNK=|grep -i $MATCH notspam.txt

:0: $PMDIR/spam.lock
* !^TObyte-sized
* $NOTJUNK ?? ^^^^
!my_spam(_at_)hotmail(_dot_)com


Search the list archives for info on proper testbed techniques -- you can set up a standalone procmail script and pipe a mailbox load of messages at it through formail to see how the filter will react.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

_______________________________________________
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>