This _is_ a FAq, of course, and I must have seen at least three slightly
different solutions... and I could never get any of them to work (i.e. the
recipes did not catch the messages they were expected to). Just tonight I
revisited the problem and tried Era's recipe:
##############################################
# experimental: SAME "TO" AND "FROM"
##############################################
:0
* ! ^FROM_DAEMON
* ! ^(From|To):.*(eristic)
* ^To: \/.*
* $ ^\/(From|Reply-To): $\MATCH
{
LOG="TRASH: from and to are the same ($MATCH)"
:0:
$TRASH
}
Now, instead of waiting for a spam to catch on this hook, I sent an email
to myself that ought to trigger the rule: a message "From" and "To" my
other account with a BCC to the procmail'ed one. Resulting headers:
From cicho(_at_)free(_dot_)polbox(_dot_)pl Mon Feb 9 00:40:39 1998
Received: from pmone234.lodz.pdi.net (pmone234.lodz.pdi.net
[195.116.162.234])
by gryzmak.lodz.pdi.net (8.8.7/2.1.1/L) with SMTP id AAA06974;
Mon, 9 Feb 1998 00:40:38 +0100
From: cicho(_at_)free(_dot_)polbox(_dot_)pl
To: cicho(_at_)free(_dot_)polbox(_dot_)pl
Subject: test: FROM and TO are the same, should be trashed
Date: Sun, 08 Feb 1998 22:36:30 GMT
Message-ID:
<34de3069(_dot_)20449312(_at_)gryzmak(_dot_)lodz(_dot_)pdi(_dot_)net>
Seems to satisfy all the conditions in the recipe... and yet it passed
through my .procmailrc like a ghost. Well, serves me right for using stuff
I can't grok, since the meaning of Era's
* $ ^\/(From|Reply-To): $\MATCH
condition escapes me. What's "$\MATCH"? OK, I know it can't be $MATCH,
since at this point $MATCH is just being assigned to the "From:" contents.
But what _is_ $\MATCH? And why no "??" for comparing the two strings?
Also... Since everything after \/ is assigned to $MATCH, it will include
the literal "From:" string, won't it? So it has no chance to ever equal the
bare email address extracted from the "To:" header one step before. Somehow
this doesn't look quite right...
BTW, I grepped the procmail manual and all the tutorials I have stashed
away for the "$\" bit and came up with nothing :)
.marek