[NTLUG:Discuss] procmail question
Patrick R. Michaud
pmichaud at pobox.com
Mon Jun 28 15:18:44 CDT 2004
On Mon, Jun 28, 2004 at 02:14:46PM -0500, Rev. wRy wrote:
> While the list of names is much longer, this snippet exists in a
> /etc/procmailrc:
>
> :0 H
> * {^From.addy1 at domain1.[com|net]|addy2 at domain1.[com|net]}
> * {^TO_addy1 at domain1.[com|net]|addy2 at domain.1.[com|net]}
> {
> LOG="ACTION"
> :0
> ${DEFAULT}
> }
>
> This is what's happening:
>
> 1) Mail from user at otherdomain is triggering the rule.
> 2) All mail for one particular user never gets to his $HOME/.procmailrc
> (as nothing is in his $HOME/proc.log), but mail is delivered.
> 3) If I comment out the above rule, everything works fine.
A few comments/questions-
1. What is the rule supposed to be doing?
2. Conditions are anded-together, so it appears to me that this rule
is intended to apply to messages that are being sent FROM addy1 TO
addy2 or vice-versa. In particular, it doesn't apply to messages
where addy1/addy2 appear in either the from line or the to line but
not both.
3. The regular expressions appear wrong in a number of ways...
a. Single brackets are used for character classes, not grouping,
so that "[com|net]} matches any single character from the set [cemnot|].
(com|net) is probably intended instead.
b. The | applies to the entire regexps on either side, so that
* {^From.addy1 at domain1.[com|net]|addy2 at domain1.[com|net]}
really says to match any From header with addy1 at domain1
immediately following OR any header containing "addy2 at domain1"
in it (doesn't have to be a From header). The condition should
probably read
* {^From.*(addy1 at domain1.(com|net)|addy2 at domain1.(com|net))}
but it's probably simpler to do as
* {^From.*(addy1|addy2)@domain1.(com|net)}
c. I'm assuming that the extra dot in "@domain.1." of the ^TO_
condition is a typo:
* {^TO_addy1 at domain1.[com|net]|addy2 at domain.1.[com|net]}
d. Note that '.' in regular expressions matches any character,
and not just a dot, thus addy1 at domain1.[com|net] would match
addy1 at domain1xc.org. So what may be needed is
* {^From.*(addy1|addy2)@domain1\.(com|net)}
Hope this helps.
Pm
More information about the Discuss
mailing list