Kevin Kelleher <kevink(_at_)concorde(_dot_)com> writes:
This recipe generates a dead.letter file every time it runs.
Is there some way I can stop it from doing that? It must
be connected with the WHOSENT business, which I only added
because I didn't know how else to end the recipe (how to
make it mail the letter).
What this does is notify the people who are still using an
old list name/list address that the address has changed.
:0
* ^TOold-listname
* !X-Loop: $LOGNAME(_at_)$HOST
{
WHOSENT=`formail -xFrom:`;
# preface the quoted message with the address-change note
:0fb
|(cat $HOME/address.change; sed -e 's/^/\> /')
# add subject line
:0fh
|formail -r -I"Subject: LISTNAME AUTO-REPLY (address has changed)"
\
-I"X-Loop: $LOGNAME(_at_)$HOST";
# mail the damn thing
:0
! $WHOSENT
}
Is there some reason you have for not using formail's -r flag to figure
out what address to send to? It will correctly decide to send your
message back to the owner of a mailing list (who should be the envelope
sender) rather than the person who submitted the message (you should be
in the From: header), as the latter person can do nothing about the use
of the old address. You may say that since this is a list address, it
should never be subscribed to other lists, but a) it may happen anyway;
b) formail catches other bad addresses in the process; and c) formail's
choice is much more likely to get to the person who should see it than
a static choice of the From: header.
If you do decide to use formail -r instead of extacting the From:
header yourself, then the following should work:
# If you have a newer procmail (3.11preN), then it probably supports ^TO_,
# which is to be prefered in most cases over ^TO. Check the MISC section
# of the procmailrc(5) manpage.
:0
* ^TOold-listname
* ! ^X-Loop: $LOGNAME(_at_)$HOST
{
# Fixup the body. This can be massively simplified if you don't
# care about returning their original message, but, well, I can
# see both sides of doing so.
:0fb
|(cat $HOME/address.change; sed -e 's/^/\> /')
# Turn around the header and send it out. The '-r' turns it around,
# will the '-kb' keeps formail from munging the (already munged) body.
:0
|formail -rkb -I"Subject: LISTNAME AUTO-REPLY (address has changed)" \
-I"X-Loop: $LOGNAME(_at_)$HOST" | $SENDMAIL -oi -t
}
Philip Guenther