procmail
[Top] [All Lists]

Re: Global filter does not work perfect.

2002-08-20 10:28:15
Juergen Bachsteffel <juergen(_at_)pass-ag(_dot_)com> writes:
Postix itself is configured not to send emails that begin with an 'i' to 
the outside.
I have account like:

ipaul(_at_)test-lokal(_dot_)com
imary(_at_)test-ag(_dot_)com

('i' stands for intern)

Incoming email sould also filtered.
I use this procmail filter.

/etc/promailrc:

:0
* ^TO_i(_dot_)*(_at_)test-ag\(_dot_)com
* !^From:(_dot_)*(_at_)test-ag\(_dot_)com
* !^From:(_dot_)*(_at_)test-lokal\(_dot_)com
/home/filter/iaccounts

It works but there are some emails
which are also catched by this filter during the week.
I dont't see what these emails have in common.

Whats's wrong? Is the filter not precise enough?

Yep.  Compare the following two conditions:

        * LOGNAME ?? ^^i

                "The username being delivered to begins with an 'i'"


        * ^TO_i(_dot_)*(_at_)test-ag\(_dot_)com

                "A recipient header contains an address beginning
                with the letter 'i' and later in the header the
                test '@test-ag.com'"

Note that the second condition is applied for _all_ recipients of the
message, not just those whose usernames begin with 'i'.  Note also that
there's no real requirement that the 'i' be part of the same address;
that condition will match the header
        To: ilya(_at_)somewhere(_dot_)else, bob(_at_)test-ag(_dot_)com


In case you haven't already guesses from the descriptions, you should
be using the LOGNAME based condition.  My rule of thumb is that ^TO
and ^TO_ should practically never be used in the /etc/procmailrc file.
Basically the only time you want to use them is in vacation recipies
to see whether the message was explicitly addressed to you and should
therefore prompt a response.


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>