SUMMARY: Bouncing e-mail of departed users

From: Fred Berns (fhb@kestnbaum.com)
Date: Fri Jun 02 1995 - 04:18:46 CDT


In case you missed it the first time...

----- Begin Included Message -----

>From fhb Mon May 29 14:07:12 1995
To: sun-managers@ra.mcs.anl.gov
Subject: SUMMARY: Bouncing e-mail of departed users
Cc: kpi@hobbes.netcom.com

Thanks for the overwhelming number of responses!

Kevan kevanh@lsl.co.uk
Mike Fletcher <fletch@ain.bls.com>
mikey@synacom.com (Mike Youngberg)
Roger Spaulding <ras@loveland.ramtron.com>
dburwell@telecom.com (David Burwell)
"Jeremy D. Zawodny" <jzawodn@cs.bgsu.edu>
"Carlo Musante" <carlo_musante@hub.eng.wayne.edu>
Ian MacPhedran <macphed@engr.USask.Ca>
Anatoly.Lisovsky@kamaz.kazan.su (Anatoly M. Lisovsky)
Chip Christian <christian_charlie@jpmorgan.com>
sozoa@atmel.com (Steve Ozoa)
epl@caps.kodak.com (Gene Loriot (epl@kodak.com))
gunn@lardav.com (David Gunn)
EDM@MOG.WR.USGS.GOV (Ed Maple, U.S. Geological Survey)
J.H.N.Chin@reading.ac.uk
Doug.Royer@Eng.Sun.COM (Doug Royer [KD6HBW])
kevin@anymore.more.com (Kevin Sheehan {Consulting Poster Child})
tim@ben.dciem.dnd.ca
Rahul Dhesi <dhesi@rahul.net>
Tim Gibbs <Tim.Gibbs@src.bae.co.uk>
Andrew Cosgriff <andrew@unico.com.au>
Jimi Xenidis <jimix@resunix.ri.sickkids.on.ca>
citicds!cntower!arash@uunet.uu.net (Arash Jahangir)
Per.Akesson@carmenta.se (Per Akesson)
Barry Margolin
"Christopher A. Stewart" <allan@mazama.com>
david@srv.PacBell.COM (David St. Pierre)
cjudi@cujo.nlm.nih.gov (Judi Connelly)
"Jeremy D. Zawodny" <jzawodn@cs.bgsu.edu>

Most suggested changing the user name in the passwd file, as Kevan
did:
----------------------------------------------------------------------
At the same time we invalidate the old users password we prefix the
user name
in the password file with x- so fred becomes x-fred.
This still allows existing users to see who owned the files, but mail
bounces because the fred user does not exist. (Note: you may want to
change
the home directory name to match the x- name.)

Many suggested to change the alias file:
---------------------------------------
You can put in an alias to redirect their mail; to either an acct of
their choice, or to some trash account. Then you can have a script go
and clean up the mail periodically.

Carlo Musante suggested simply forwarding the mail to /dev/null:
I have the following set up in my alaises file for just such
occasions.

# Mail group names that just won't die.
#
hades:/dev/null
agus:hades
gang:hades
mlu:hades

or perhaps to a dummy account (per Ian MacPhedran)

fhb:not_a_user

Per Ed Maple:
One possible solution might be to have an entry for each dearly
departed
employee in your /etc/aliases file redirecting their email into a
common
holding file which could be periodically cleaned out with a cron job.

Per J.H.N Chin:
You could create an alias (in /etc/aliases or NIS(+) equivalent)
that points to a non-existent address, "user.is.no.longer@here" say
where user -> user in question and here -> your mail domain.

Simple, effective, and even returns a vaguely comprehensible error
message:

>Your message was not delivered to user.is.no.longer@here

Still others recommended installing a .forward or .vacation file:
----------------------------------------------------------------
Anatoly M. Lisovsky:
Create .forward file in theirs home directory and just put "nobody"
into it.
(nobody is aliased to /dev/null).

Of course, Gene Loriot suggest I be a bit more polite:
OOOOO nasty! You Don't really mean you want to bounce mail back to the
mail servers....like this list???? It is a pain, but don't you think
that
it is better to unsubscribe the wayward soul's end trails??

In addition, a couple people included scripts to handle mail
responses:
-----------------------------------------------------------------------

David St. Pierre:
-----[CUT HERE]----------------------------------------------

i wrote "return.mail". it was meant to tell the sender about a
recipients
new mail address. it is trivial to change it into a straight "bounce"
message.

you implement it by putting something into /etc/aliases:

joe-user: "|/usr/local/etc/return.mail joe-user@cia.gov"

i use ksh all of the time but /bin/sh will probably work just fine.

#!/bin/ksh

PATH=/bin:/usr/ucb
TMPA=/tmp/return.mail.$$a
TMPB=/tmp/return.mail.$$b
umask 066

trap 'rm -f $TMPA $TMPB;trap 0;exit' 0 1 2 15

cat >$TMPB
ET=`grep -i "^errors-to:" $TMPB|line|sed -e
's/^[Ee][Rr][Rr][Oo][Rr][Ss]-[Tt][Oo]://'`
ET=`echo $RT|sed -e 's/ (.*//' -e 's/.* <//' -e 's/>//'`

RT=`grep -i "^reply-to:" $TMPB|line|sed -e
's/^[Rr][Ee][Pp][Ll][Yy]-[Tt][Oo]://'`
RT=`echo $RT|sed -e 's/ (.*//' -e 's/.* <//' -e 's/>//'`

FROMHDR=`grep -i "^from:" $TMPB|line|sed -e 's/^[Ff][Rr][Oo][Mm]://'`
FROMHDR=`echo $FROMHDR|sed -e 's/ (.*//' -e 's/.* <//' -e 's/>//'`

FROM=`grep "^From " $TMPB|line|sed -e 's/^From //' -e 's/ .*//'`

if [ -n "$ET" ]; then
        RETURN=$ET
elif [ -n "$RT" ]; then
        RETURN=$RT
elif [ -n "$FROMHDR" ]; then
        RETURN=$FROMHDR
elif [ -n "$FROM" ]; then
        RETURN=$FROM
else
        exit 0
fi

logger -t return -p local3.info $1 $RETURN

case "$RETURN" in
*root*) exit 0;;
*nobody*) exit 0;;
*uucp*) exit 0;;
esac

echo "To:" $RETURN >${TMPA}
echo "From: nobody@gw.PacBell.COM (Postmaster)" >>${TMPA}
echo "Subject: mis-addressed mail" >>${TMPA}
echo "" >>${TMPA}

cat <<-EOF >>${TMPA}
#####################################################################
THE FOLLOWING MAIL MESSAGE WAS MIS-ADDRESSED.
AS A COURTESY, IT IS BEING RETURNED TO YOU.
IT SHOULD BE RE-SENT TO ${1}
#####################################################################

EOF

cat ${TMPA} ${TMPB} | /usr/lib/sendmail -fnobody@gw.pacbell.com $RETURN

-----[CUT HERE]----------------------------------------------

Jeremy D. Zawodny <jzawodn@cs.bgsu.edu>:

-----[CUT HERE]----------------------------------------------

[/usr/local/mail/bounce]
#!/bin/perl

# bounce - bounce a mail message back to its author, with the $ARGV[0]
# message.

# locate the author of this message
while (<STDIN>) {
        $header .= "$_";
        last if (/^$/); # blank line separates body from message
        $to = $_ if (s/From:(.*)/$1/i); # from line found
}

# send a letter to the author
$ENV{'PATH'} = '/bin:/usr/bin';
open(SMAIL,"|/usr/lib/sendmail -t");
print SMAIL "To:$to";

# include our boilerplate
open(LETTER,$ARGV[0]);
print SMAIL $_ while(<LETTER>);
close(LETTER);

# and the original letter
print SMAIL "$header";
print SMAIL $_ while (<STDIN>);

close (SMAIL);
#

-----[CUT HERE]----------------------------------------------

[/usr/local/mail/bounce.gone]
        postmaster
From: The Silicon Postmaster <postmaster@cs.bgsu.edu>
Subject: Mail recipient has left Bowling Green State University
Computer Science

You sent the following message to a user in the Computer Science
Department
at Bowling Green State University. This person is no longer in our
department.
Unfortunately, no forwarding e-mail address was left.

The message was not delivered.

Thank You,
The Silicon Postmaster, <postmaster@cs.bgsu.edu>

Unsent Message Follows...

-----[CUT HERE]----------------------------------------------

Fred H. Berns, Systems Manager
Kestnbaum & Company Chicago, Illinois
Database Marketing Consultants

Email: fhb@kestnbaum.com
Voice: (312) 782-1360 x220
  Fax: (312) 782-1362

----- End Included Message -----



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:26 CDT