Subject: RESOLVED Re: Creating "Recipient List Suppressed" Email

From: [email-masked] (Ed Skinner)
Date: Fri, 18 Apr 2003 13:37:18 -0700

Thanks for the suggestions. I've included a finished script (below) for 
the packrats. Please note that I've only tested this on Red Hat 8.0. YMMV.
     A couple of notes.
1) The "mail" program (on my machine, Red Hat 8.0) does not permit additional 
header lines to be inserted.
2) Using sendmail seems to work (see below) but because it resides in 
/usr/sbin which is not normally in a user's PATH, I had to spell it out.
3) Sendmail inserts a warning: "X-Authentication-Warning: gort.rytetyme.com: 
eskinner set sender to [email-masked] using -f" (in my case). I 
supposed a spam-sniffer might kick the message out based on that (or any 
other) warning. But if the message gets to the intended receivers mailbox, I 
suspect they'll more likely ignore the warning anyway. That's sufficient for 
my purposes.
4) After due consideration, I find I agree with the advice of avoiding 
"Recipient List Suppressed" and have written the shell script (below) 
accordingly.
     Thanks to all!
     Here's the script. I called it "mailas". (It could certainly be made 
fancier and more robust if someone were so inclined. I'm not, however. It 
works and I'm moving on to the next task.)
     Oh yeah, there's no copyright so do as you wish with it.

#!/bin/sh
# mailas
# Cobbled together 04/18/03 by Ed Skinner ([email-masked])
# Tested only on Red Hat 8.0
#
if [ $# -ne 3 ] ; then
	echo "Usage: mailas from@domain to@domain subject < messagebody"
	echo "   Omit domain(s) to have your local domain inserted."
	echo "   You'll probably want the subject in quotes."
	echo "   Unlike simple mail, messagebody will be read to <EOF>:"
	echo "      (lines with just a . will be included in the message)"
	exit 1
fi
#
SRC=$1
DEST=$2
SUBJECT=$3
#
( echo "To: $DEST"; \
  echo "Subject: $SUBJECT"; \
  echo ""; \
  cat - ) \
| /usr/sbin/sendmail -f $SRC $DEST
#
exit 0

-- 
Ed Skinner, [email-masked], http://www.flat5.net/