procmail
[Top] [All Lists]

Re: parsing mutt's alias file

2000-11-23 02:10:36
cory <cory(_at_)olga(_dot_)net> writes:
I've built my own spam filters (I don't like the hands-off approach of
the spam bouncer) but want to not filter friends.  Rather than
hard-code it, I'd like to parse my mutt aliases file (of the form)

alias Alias   Firstname Lastname   <email(_at_)domain(_dot_)com>

How should I go about checking the From: field, verifying that the
sender is not a friend?

I could just grep it, but I think that's not so elegant (and could
return false positives).

Grepping it is the easiest solution:
        # Extract the header sender address (comments and phrase are stripped)
        FROM = `formail -rtzxTo: -IReply-To:`
        :0
        * ! ? fgrep -q "<$FROM>" $MAIL/.mutt-alias-file-wherever-it-is
        not-in-alias-file

The brackets in the string being searched for, the use of fgrep instead
of grep or egrep, and ignoring the Reply-To: header when determining
the sender address should take care of most false positives.  Now, if
the addresses of some of your friends vary (for example, you only send
to one address, but theirs change according to what machine they send
from) then the above will give you a false negative.  You may have to
special case those people/addresses by adding a condition before the
fgrep condition that checks for those trouble addresses.


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