Newsgroups: comp.mail.sendmail
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!fernwood!csl!hercules!hogan
From: hogan@csl.sri.com (Emmett Hogan)
Subject: Re: sendmail 5.65+IDA, e-mail privacy.
In-Reply-To: rickert@mp.cs.niu.edu's message of Sat, 22 Jun 1991 15:22:16 GMT
Message-ID: <HOGAN.91Jun24120300@cujo.csl.sri.com>
Sender: news@csl.sri.com (NEWS Administrator)
Organization: Computer Science Lab, SRI International, Menlo Park, CA.
References: <1991Jun21.060835.904@melb.bull.oz.au> <tih.677595600@barsoom>
	<1991Jun22.152216.31427@mp.cs.niu.edu>
Distribution: comp
Date: 24 Jun 91 12:03:00
Lines: 88


Here is a simple shell script I use to filter out the Subject and the
body of the bounced messages...I got it from the net last year...so be
sure to give the credit to Andy Poling, who wrote it.

By sendmail.cf file has the following entry:

OPMailError

And in my aliases file I have the entry:

MailError: "|/usr/local/lib/mail/error_filter"


Where error_filter is the following shell script:

-------------------8<------cut here------8<-------------------------
#!/bin/sh
#
#  This is a filter for error messages to avoid disclosing
#  private mail to the postmaster
#
#  What it does is:
#  * remove the Subject: line from the headers of the bounced mail
#  * remove the message body
#
# Andy Poling	5-29-90
# (andy@gollum.hcf.jhu.edu)
#

TMPFILE=/tmp/mailfail.$$
trap "rm $TMPFILE; exit" 1 2 3 4 5 6 7 8 9 15

echo "Subject: FAILED MAIL

================================= FAILED MAIL =============================" > $TMPFILE
chmod 600 $TMPFILE

##
## read everything up to the failed message header
##
while read LINE
do
	if [ "$LINE" = "----- Unsent message follows -----" ]
	then
		echo "   ----- Unsent message headers -----" >> $TMPFILE
		break
	fi
	echo $LINE >> $TMPFILE
done

##
## read the failed message header, then stop before message to preserve privacy
##
while read PART1 PART2
do
	if [ "$PART1" = "" -a "$PART2" = "" ]	## end of mesage header
	then
	   /usr/5bin/echo "\n\n[message body removed for privacy]" >> $TMPFILE
	   break
	fi
	if [ "$PART1" = "Subject:" ]		## delete Subject: line too
	then
		echo $PART1 "[removed for privacy]" >> $TMPFILE
	else
		echo $PART1 $PART2 >> $TMPFILE
	fi
done

/usr/lib/sendmail -fMailer-Daemon Postmaster@csl.sri.com < $TMPFILE

rm $TMPFILE

-----------8<-----cut here-----8<------------------------------------------

Hope this helps,
Emmett


--
-------------------------------------------------------------------
Emmett Hogan              Computer Science Lab, SRI International
Inet: hogan@csl.sri.com
UUCP: {ames, decwrl, pyramid, sun}!fernwood!hercules!hogan
USMAIL: EL231, 333 Ravenswood Ave, Menlo Park, CA  94025
PacBell: (415)859-3232 (voice), (415)859-2844 (fax)
ICBM: 37d 27' 14" North, 122d 10' 52" West
-------------------------------------------------------------------
