procmail
[Top] [All Lists]

Re: Many different addresses for self

1998-02-24 15:05:11
Timothy Luoma wrote,

| I want to make a variable which has all sorts of different addresses for
| myself.
| 
|       luomat@
|       timothy.luoma@
|       tjluoma@
|       @luomat.peak.org
| 
| So I can use it like this:
| 
| ME="luomat|(476tjl|timothy\.luoma)@(ptsmail\.)?ptsem\.edu|@luomat\.peak\.org"

| :0
| * ^(To|Cc):.*$ME
| { LOG="
| To me" }

(1) You're leaving out the "$" modifier to tell procmail to do variable
    and command substitution before evaulating the regexp.

(2) You probably are better off with the ^TO_ or ^TO token.

(3) After you take care of #1 and $ME is expanded, procmail won't know
    that you think of "$ME" as a unit, so it will see this:

^(To|Cc):.*luomat|\
 (476tjl|timothy\.luoma)@(ptsmail\.)?ptsem\.edu|\
 luomat\.peak\.org

   and that is not what you mean.  In particular, any mention of
   luomat.peak.org in a Received: header will cause a match.  To solve that
   you need parentheses around the expression for your addresses.  You could
   add them in the variable assignment like this:

ME="(luomat|(476tjl|timothy\.luoma)@(ptsmail\.)?ptsem\.edu|@luomat\.peak\.org)"

or you could add them in the condition, like this:

  :0
  * $ ^TO_($ME)
  { LOG="
To me" }

I prefer the latter because then, if there are other parentheses or pipes in
the condition, or if the variable is followed by an asterisk, a question
mark, or a plus sign, the condition will be easier to read if the parentheses
are there to be seen in it.  It hurts very little to have the parentheses in
both places, so you might want to do that just to be positive they're there.

| :0E
| * ! ^(To|Cc):.*$ME
| { LOG="
| Not To Me" }

If you have an `E' flag, the negative of the previous condition is implicit,
and it's just a waste to double-check for it:

  :0E
  { LOG="
Not to me" }

| But that doesn't work.... they all show up 'not to me'

Without the "$" modifier, "$ME" means <newline><M><E>.  There would be a
match only if the Message-Id: header were immediately under a To: or Cc:
header.

<Prev in Thread] Current Thread [Next in Thread>