First of all, an apology to everyone who tried to help me and
got blasted as a result, particularly Stephen. There were a
number of things that I didn't say in my email so of course
you all assumed that I wasn't actually trying what you
suggested. The suggestion was to use
WHOSENT=`formail -rtzxTo:`
to generate a return address. I insisted that it didn't work
because I had in fact tried it without success.
The reason it didn't work had nothing to do with the command.
The above command
works perfectly. I didn't realize that the options would
be executed one after the other, so that it extracts the "To"
from the correctly generated return address. OK.
So why didn't it work? I was testing it by sending mail from
another email account of mine - an account that also uses
procmail to forward some mail back to kevink(_at_)concorde(_dot_)com(_dot_)
I hadn't bothered using the X-Loop headers to keep it from
looping, so guess what? It looped.
When I saw sendmail complaining about "too many hops" I assumed
that the return address had been generated incorrectly.
So, now that I'm using the solution offered, have inserted
the X-Loop controls, there is no more dead.letter file created.
Incidentally, I found a good way to test what formail does -
certainly obvious, but one that didn't occur to me to use to
test your suggestion. If you save an email to a file, you can
pipe it to formail and see what it does:
cat testmail | formail -rtzxTo:
and see what pops out.
Again, I'm sorry that lost my temper with those of you who
tried to help me. Next time I have a question I'll try to
give all the relevant details.
Kevin Kelleher <kevink(_at_)concorde(_dot_)com>