[comp.mail.sendmail] Mailing list remailer

gz@cambridge.apple.com (Gail Zacharias) (04/09/90)

Does anybody have a program that would add Errors-To: lines to headers
or maybe massage the return-path or whatever else seems appropriate for
automatically remailing messages to a large mailing list in such a way
that errors get reported to the list maintainers?  Thanks.

--
gz@cambridge.apple.com

Craig_Everhart@TRANSARC.COM (04/09/90)

(A) I think sendmail will do this itself if you have the right aliases. 
That is, if it's expanding entry foo-list, then if you have an entry for
owner-foo-list, it will be used as the Errors-to: address in headers of
outgoing mail.

Of course, this is somewhat brain-damaged, since error messages don't
usually go to an Errors-to: line.  In Internet land, they go to the
envelope-from information, which in SMTP comes from the MAIL FROM:
command.  (Substitute your favorite protocol here.)  Interpreting RFC
822 (mail header stds) without RFC 821 (SMTP stds), you might think that
error messages are supposed to go to the Sender: address.

(B) If mail is submitted through some special path, you can specify the
``-r'' (same as ``-f'') option argument in the invocation line for
sendmail that enqueues this piece of mail in sendmail's queue.  That is,
rather than saying
	/usr/lib/sendmail foo-list
you could say
	/usr/lib/sendmail -r foo-list-request foo-list
to get it to set the envelope-from information to the argument to the
``-r'' option, ``foo-list-request'' in this case.

(C) AMS/AMDS distribution lists, in software free for the running in the
X.V11R4 distribution, run exactly this way.  A ``distribution list'' in
its parlance is not simply a new set of mail destinations, but also new
envelope-from information.  That is, at the same time as you replace the
envelope-to information to get mail to go to a different place, it's a
sensible default action to replace the envelope-from information so that
error messages about redistributing the mail get sent to the list
maintainer who can ostensibly do something about them.

		Craig

karl_kleinpaste@giza.cis.ohio-state.edu (04/10/90)

gz@cambridge.apple.com writes:
   Does anybody have a program that would add Errors-To: lines to headers
   or maybe massage the return-path or whatever else seems appropriate for
   automatically remailing messages to a large mailing list in such a way
   that errors get reported to the list maintainers?  Thanks.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Aliases
#	README
#	Reject
#	SendScript-complex
#	SendScript-simple
#	Unauthorized
#	usr-lib-aliases
# This archive created: Mon Feb 19 17:09:12 1990
# By:	Karl Kleinpaste (OSU)
export PATH; PATH=/bin:$PATH
echo shar: extracting "'Aliases'" '(59 characters)'
if test -f 'Aliases'
then
	echo shar: will not over-write existing file "'Aliases'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'Aliases'
KKsample@address.number1.edu
KKsample!address!number2!somebody
MAILING-LIST-MGMT
if test 59 -ne "`wc -c < 'Aliases'`"
then
	echo shar: error transmitting "'Aliases'" '(should have been 59 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'README'" '(1237 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'README'
KKIn the shar file you have just unpacked, you should have found:
KK
KKREADME			This file.
KKAliases			Sample aliases file.
KKReject			Sample rejection notice for use
KK			with SendScript-complex.
KKSendScript-complex	Control script which provides a "fire extinguisher."
KKSendScript-simple	Simplistic, mindless control script.
KKUnauthorized		Sample file of unauthorized posters, for
KK			use with SendScript-complex.
KKusr-lib-aliases		Sample alias configuration for putting it all to use.
KK
KKIf you don't need to prevent obnoxious users from posting to the
KKlist(s) you mange, toss Reject, Unauthorized, and SendScript-complex.
KK
KKFor simple lists, install the appropriate variations on
KKusr.lib.aliases into your own /usr/lib/aliases, create the directory
KKfrom which the list will be managed, and place the Aliases and
KKSendScript file there, modifying SendScript's "address" and "domain"
KKvariables appropriately.
KK
KKFor complex lists requiring the fire extinguisher, do the above, but
KKuse SendScript-complex as SendScript, and include the (edited) Reject
KKmessage, plus an initially empty Unauthorized file.
KK
KKDon't forget to rerun newaliases so that the alias updates take
KKeffect.
KK
KK--karl kleinpaste
KKPesonification of the Mailer Daemon
KKOhio State Computer Science
MAILING-LIST-MGMT
if test 1237 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 1237 characters)'
fi
chmod +x 'README'
fi # end of overwriting check
echo shar: extracting "'Reject'" '(219 characters)'
if test -f 'Reject'
then
	echo shar: will not over-write existing file "'Reject'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'Reject'
KKThe following note has been rejected by the "fire extinguisher" of the
KK<list-name> mailing list.  If you wish to question the rejection,
KKplease send your note to the list maintainer.
KK
KK--Karl Kleinpaste
KKList Maintainer
KK
MAILING-LIST-MGMT
if test 219 -ne "`wc -c < 'Reject'`"
then
	echo shar: error transmitting "'Reject'" '(should have been 219 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'SendScript-complex'" '(1321 characters)'
if test -f 'SendScript-complex'
then
	echo shar: will not over-write existing file "'SendScript-complex'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'SendScript-complex'
KK#!/bin/csh -f
KK# CONFIG HERE.
KKset dir=/directory/used/for/list/maintenance
KKset address=list-name
KKset domain=your.domain.name
KKset path=(/usr/local/bin /usr/ucb /bin /usr/bin)
KK#
KK# Prepare for cleanup
KKset tmp1=/tmp/list.1.$$
KKset tmp2=/tmp/list.2.$$
KKset tmp3=/tmp/list.3.$$
KK#
KK# Save the incoming mail, then find the From: line
KKcat - > $tmp1
KKgrep '^From: ' $tmp1 | head -1 | sed -e 's/^From: //' > $tmp2
KK#
KK# Determine if it's "name <add@re.ss>" or "add@re.ss (name)."
KKgrep -s '<' $tmp2 >& /dev/null
KKif ($status == 0) then
KK	# Address contained within <>
KK	sed -e 's/^.*<\(.*\)>.*$/\1/' < $tmp2 > $tmp3
KKelse
KK	# Address in any other form
KK	sed -e 's/(.*)//' -e 's/".*"//' -e 's/ //' < $tmp2 > $tmp3
KKendif
KK#
KK# Look for that address in the Unauthorized file.
KKfgrep -i -s -f $dir/Unauthorized $tmp3 >& /dev/null
KKif ($status == 0) then
KK	# Reject.
KK	cat $dir/Reject $tmp1 | Mail -s 'Rejected note' \
KK		`cat $tmp3` $address-request@$domain
KKelse
KK	# Accept.
KK	cat $tmp1 | sed -e '/^Reply-To:/d' -e '/^Sender:/d' -e '/^From /d' | \
KK		(echo Errors-to: $address-request@$domain; \
KK		 echo Sender: $address-request@$domain; \
KK		 echo Reply-To: $address@$domain; \
KK		 echo Precedence: bulk; \
KK			cat -) | \
KK		/usr/lib/sendmail -f $address-request@$domain \
KK			-F "$address Mailing List" $address-out
KKendif
KK#
KK# Done.
KKrm -f $tmp1 $tmp2 $tmp3
KKexit 0
MAILING-LIST-MGMT
if test 1321 -ne "`wc -c < 'SendScript-complex'`"
then
	echo shar: error transmitting "'SendScript-complex'" '(should have been 1321 characters)'
fi
chmod +x 'SendScript-complex'
fi # end of overwriting check
echo shar: extracting "'SendScript-simple'" '(397 characters)'
if test -f 'SendScript-simple'
then
	echo shar: will not over-write existing file "'SendScript-simple'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'SendScript-simple'
KK#!/bin/csh -f
KKset address=list-name
KKset domain=your.domain.name
KK/bin/sed -e '/^Reply-To:/d' -e '/^Sender:/d' -e '/^From /d' | \
KK	(echo Errors-to: $address-request@$domain; \
KK	 echo Sender: $address-request@$domain; \
KK	 echo Reply-To: $address@$domain; \
KK	 echo Precedence: bulk; \
KK	 /bin/cat -) | \
KK	/usr/lib/sendmail -f $address-request@$domain \
KK		-F "$address Mailing List" $address-out
KKexit 0
MAILING-LIST-MGMT
if test 397 -ne "`wc -c < 'SendScript-simple'`"
then
	echo shar: error transmitting "'SendScript-simple'" '(should have been 397 characters)'
fi
chmod +x 'SendScript-simple'
fi # end of overwriting check
echo shar: extracting "'Unauthorized'" '(89 characters)'
if test -f 'Unauthorized'
then
	echo shar: will not over-write existing file "'Unauthorized'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'Unauthorized'
KKsample-nasty-username%some.domain.com@relay.cs.net
KKsample-nasty-username@some.domain.com
MAILING-LIST-MGMT
if test 89 -ne "`wc -c < 'Unauthorized'`"
then
	echo shar: error transmitting "'Unauthorized'" '(should have been 89 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'usr-lib-aliases'" '(231 characters)'
if test -f 'usr-lib-aliases'
then
	echo shar: will not over-write existing file "'usr-lib-aliases'"
else
sed 's/^KK//' << \MAILING-LIST-MGMT > 'usr-lib-aliases'
KKlist-name-request:	karl
KKlist-name:		"|/directory/used/for/list/maintenance/SendScript"
KKowner-list-name:	list-name-request
KKlist-name-out:		:include:/directory/used/for/list/maintenance/Aliases
KKowner-list-name-out:	list-name-request
MAILING-LIST-MGMT
if test 231 -ne "`wc -c < 'usr-lib-aliases'`"
then
	echo shar: error transmitting "'usr-lib-aliases'" '(should have been 231 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0