At 08:35 2003-03-31 -0500, Patrick Shanahan did say:
> Let me advice how can I block multiple domains in the single line or
> via file. The following is not working.
A solution was presented, but the actual cause of your problem wasn't given
by Patrick. Each:
> * ^From:.*\<transmitr.net\>
> * ^From:.*\<iExpect.com\>
Is an *AND* condition. Your recipe would have matched only if ALL of those
addresses had matched. *AND* the kousar recipient matched.
You need a ..line..continuation..character.. and ..only.. one rule per
recipie, also '\>' and '|<' are special cases, ie:
:0
If $BADMAILS1 is a mailbox, I'd suggest a lockfile flag at the end of the
flags line...
* ^From:.*(transmitr\.net|\
iExpect\.com|\
zoanmail\.com|\
responsesystems\.org|\
liwxtry\.com)
If the TO is supposed to be in addition to the From: conditions, versus an
OR, then you'd retain it as a separate condition, otherwise, you'd add
another parenthesis to the above and or the header, or use scoring.
Note that the dots in the domains have been escaped...
There's also scoring:
:0:
* 9876543210^0 ^TOkousar
* 9876543210^0 ^From:.*transmitr\.net
* 9876543210^0 ^From:.*iExpect\.com
* 9876543210^0 ^From:.*zoanmail\.com
* 9876543210^0 ^From:.*responsesystems\.org
* 9876543210^0 ^From:.*liwxtry\.com
$BADMAILS1
If ^TO is an ANDed condition, remove the scoring numbers from that one
line. Also, it is much easier to put it at the top for logic reasons,
whether ANDed or OR'ed - the specific recipient is _probably_ more likely
to be specified than any of the given senders - so if it is an OR (with
score), the message would match right away and not have to check for the
others, and if an AND (no score), if it doesn't match, the (multiple) other
values are not checked for.
You could combine the scoring and parenthesised OR forms as well.
To be even more correct, since the from strings are obviously domain
portions of addresses, you could match for this sort of syntax:
@([-0-9a-z_.]\.)?domain\.tld\>
While you're highly unlikely to mismatch the above domains against
shortened hostnames, consider the following:
^From:.*usa.net
could match: usa.networkprofessionals.com
By trailing with a \> *REGEXP* (that's not an escaped closing angle
bracket!), you dictate that this must be followed by a wordbreak. That
unfortunatley means that it _could_ match a dot:
usa.net.com
(like uk.net.com, europe.net.com, or whatever, and the idea isn't as far
fetched as you might think, though yea, you're probably not going to bump
into it).
Instead, you could use the following regexp with each of those match
domains (or parenthesize the domain list in place of 'domain\.tld' in this
regexp):
* ^From:.*@([-0-9a-z_.]\.)?domain\.tld([^-.a-z0-9]|$)
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail