procmail
[Top] [All Lists]

Re: funny things with ^TO and CC

1996-03-04 17:34:52
At 15:14 96-03-04, sjm wrote:

I use procmail for (besides other things) to provide permanent email addresses
for some friends. To do so I do some simple reflecting. This seems to have
worked fine for a while but a message just came in (from a mailing list) that
my recipe didn't catch and I am trying to figure out what to do about it.

The problem isn't in the ^TO macro.  The problem is that you're trying
to route mail based on header information, not envelope information
(which appears to be lost by the time the mail reaches you. I'm betting
you have all mail for domain judgement.com forwarded to your one
account: <smorris(_at_)xionics(_dot_)com>).  The destination address does not
appear in the headers on mailing list distribution and when mail is
addressed via the BCC: header (well, except that some email gateways
(eWorld.com) make the BCC information public in the headers -- guess
Apple really doesn't have a clue).

Fortunately, one of the intermediate routers puts this information into
one of the Received headers, so (at least for some cases, and until
they change their sendmail configuration) you should be able to add
something to your recipies to look for this (see below).  There's a
good chance they won't put the information in if there are multiple
address to judgement.com, though.  To test, send mail via bcc: to
bogus1(_at_)judgement(_dot_)com & bogus2(_at_)judgement(_dot_)com, and check 
the headers.
This could cause trouble if you have two friends on the same list.

A better solution would be to have your friends subscribe to mailing
lists from their current email address! However, that still won't solve
the BCC: problem.

Okay, with that preamble out of the way here's how I deal with the
problem, modified for your case:
# add X-Envelope-To: header for all mail
:0
* ^Received:.*\<by tango\.rahul\.net\>.*for \<\/[^(_at_)]+@judgement\.com
{
    # specific information in Received Header
    :0 hfw
    | $FORMAIL -i "X-Envelope-To: $MATCH"
}
:E
* ^Received:.*\<by tango\.rahul\.net\>
{
    # no info in received header, but most likely sent to judgement.com
    # address
    :0 hfw
    | $FORMAIL -i "X-Envelope-To: ### MULTIPLE JUDGEMENT RECIPIENTS ###"
}
:E
{
    # doesn't look like a judgement.com addr, so ASSUME local address
    :0 hfw
    | $FORMAIL -i "X-Envelope-To: smorris(_at_)xionics(_dot_)com"
}

Then recipies can forward based on the X-Envelope-To header, and not
use the ^TO macro at all.  As in:
:0
* !^FROM_DAEMON
* ^X-Envelope-To:(_dot_)*mary(_at_)judgement(_dot_)com
! fpitney(_at_)lynx(_dot_)neu(_dot_)edu

PS. I am running an old version of procmail in case that makes a difference.

If your procmail doesn't support $MATCH, the above won't work. Upgrade.

--Hal
Hal Wine <hal(_at_)dtor(_dot_)com>     voice: 510/482-0597


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