Mail questions

Chip Salzenberg chip at ateng.com
Tue Aug 1 04:32:25 AEST 1989


[Followups to comp.mail.misc]

According to jamesf at ibmpcug.UUCP (James Fielding):
>Does anyone know how to set up SCO Xenix so that any incoming
>UUCP/Usenet mail which is not addressed properly and gets bounced, is
>also copied to the uucp account mail box on my system.

You can probably do this with Deliver, which is typically used as a back end
for Smail. (You recompile Smail to run /usr/bin/deliver for local mail.)

With Deliver, you write a "system delivery file" -- a shell script -- to
control where mail goes.  But of course, since it's a shell script, you can
do other things besides control the delivery process.

Since Smail does the aliasing, any names handed to deliver should be valid
user names from /etc/passwd.  So, then, here is a sample delivery file that
sends a list of invalid addresses, along with the message itself, to "uucp":

	: deliver.sys

	# Collect invalid addresses

	invalid=
	for u
	do
	    if grep "^${u}:" /etc/passwd >/dev/null
	    then
		: no problem
	    else
		invalid="$invalid $u"
	    fi
	    echo $u
	done

	# Note: if any invalid addresses are found, deliver will exit(1),
	# causing Smail to bounce the message.
	# Our only job here is to send the administrator some hate mail.

	if [ "$invalid" ]
	then
	    (
		echo "Mail was sent to the following invalid address(es):"
		echo "    $invalid"
		echo "The mail has been bounced.  Here is a copy of it."
		echo "==================================================="
		cat $HEADER $BODY
	    ) | mail -s 'Boing' uucp
	fi


Of course, further elaboration is possible.  Also, be sure that "uucp" is
a valid address, or you'll have an infinite mail loop.
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg         |       <chip at ateng.com> or <uunet!ateng!chip>
A T Engineering         |       Me?  Speak for my company?  Surely you jest!



More information about the Comp.unix.wizards mailing list