I had written about Jim Osborn's question:
| >I suppose that (being a ksh kind of guy), I'd attack it in a fashion like
| >this:
|
| > formail -XFrom: -s < folder | ( date ; while read victim ; \
| > do Mail -s "You're in for it now" "$victim" < canned_text ; \
| > echo "$victim" ; \
| > done ; echo ) >> rogues_gallery
Stephen van den Berg responded,
| This generates a new mail for every victim. It would be more efficient
| to gather a list of victims first, then hand it off to the mailer en-bloc.
True, but I was under the impression that that was what Jim wanted: a sepa-
rate mailing to each person. After all, he wanted to do multiple commands
for each such person; wasn't that his original question?
To send one mailing to all of them, using From: addresses, one can do this:
( formail -iBcc: -RFrom: Bcc: -XBcc: -s < folder ; cat canned_text ) | \
$SENDMAIL -oi -t
where canned_text contains a Subject: header, a dummy To: header (to prevent
a long list of Apparently-To:'s), any other requisite header lines, a blank
line, and then the body text.
To use formail -r or -rt's decision on reply addresses,
( formail -r[t]zxTo: -s < folder | formail -R To: Bcc: ; cat canned_text ) \
| $SENDMAIL -oi -t