procmail
[Top] [All Lists]

Re: To = From

1999-02-19 04:55:16
On Thu, 18 Feb 1999 17:49:52 +0100, Christer Borang
<mort(_at_)dtek(_dot_)chalmers(_dot_)se> wrote:
In message 
<Pine(_dot_)LNX(_dot_)3(_dot_)96(_dot_)990218093112(_dot_)6773A-100000(_at_)argo(_dot_)dancris(_dot_)com>,
Michael Rawls writes:
possible for me to have procmail determine if the "To:" address and the
"From:" address are the same?
:0 h
SPAM_FROM=| formail -z -x 'From:'
:0 h
SPAM_TO=| formail -z -x 'To:'
# Is From: and To: identical?
:0 w
* ? test "$SPAM_FROM" = "$SPAM_TO"
* !^TOchalmers.se
xmail/SPAM/.

The call to test seems a little bit superfluous. You can do pretty
much the same completely in Procmail, although this solution (which is
straight out of my procmail/spam.rc) is not quite as general
(specifically, it just looks for completely identical fields --
ignoring any trailing fluff, which in principle is not a good idea--,
not the actual stripped addresses being equal):

    :0
    * ! ^FROM_DAEMON
    * ^To: \/.+
    * $ ^\/(From|Reply-To): $\MATCH
    { REJECT="$REJECT${REJECT:+$NL}${REJ}To: equals $MATCH" }

If you don't want to check for Reply-To being equal to To:, just take
that out. 

And note that many MAILER_DAEMON bounce messages are addressed to the
local postmaster, so I try to exclude them. Christer's suggestion to
exclude messages which are also addressed to yourself (or, in his
example, to his domain) seems like a better solution, though, but I
haven't tested it in practice yet.

/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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