procmail
[Top] [All Lists]

Re: FROM_MAILER and FROM_DAEMON match too much

1997-03-12 12:50:27
Bob Weissman asked,

| I'm having trouble with a user whose email address is
| user(_at_)mail(_dot_)company(_dot_)com(_dot_)  Apparently, the "mail" part 
after the "@" is
| causing the FROM_DAEMON and FROM_MAILER regexps to match.
|
| Does anyone have an easy fix for this?

I have a painful fix for it, but it worked when I used to have a correspon-
dent who had short-sightedly gotten a logname that included "admin".  It is
not pretty.

  DUMBIDBIAS=0 FROM_MAILER=! FROM_DAEMON=!

  :0
  * 1^1 ^((Resent-)?(From|(X-?)Sender|Reply-To|Return-(Path|Receipt-To)):|\
        From 
)(.*\<)?(user(_at_)mail\(_dot_)company\(_dot_)com|other(_at_)badly\(_dot_)chosen\(_dot_)addresses)
  { DUMBIDBIAS = $= }  # leave at zero if score is negative (or zero)

  # If total matches to ^FROM_DAEMON exceed bogus ones, some are real.
  :0
  * 1^1 ^FROM_DAEMON
  * $ -$DUMBIDBIAS^0
  { FROM_DAEMON=!! }

  :0 # similarly for ^FROM_MAILER
  * 1^1 ^FROM_MAILER
  * $ -$DUMBIDBIAS^0
  { FROM_MAILER=!! }

Thereafter, use the $ modifier and $FROM_DAEMON or $FROM_MAILER instead of
^FROM_DAEMON and ^FROM_MAILER.

(Yes, the same result could be accomplished by unsetting the variables in
 the last two actions, but I think a setup where a variable is false if it
 has a value and true if it's unset is counterintuitive.)

Alternatively, you could use the last two recipes for final disposition of
mail that really matches ^FROM_DAEMON or ^FROM_MAILER instead of using them
only to change the variable.

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