BSD mail .forward question

Randal L. Schwartz @ Stonehenge merlyn at intelob.intel.com
Sun Feb 5 06:53:25 AEST 1989


In article <Feb.3.09.50.22.1989.25618 at athos.rutgers.edu>, mende at athos (Bob Mende Pie) writes:
| In article <6218 at saturn.ucsc.edu> haynes at ucscc.UCSC.EDU (Jim Haynes) writes:
| 
| > I have a user with accounts on two different machines here.  He would
| > like to have it so that when he receives mail addressed to either machine
| > a copy is delivered to both machines.
| 
| yes ... but it is a hack...
| 
| on machine1 have a .forward that looks like:
| user at machine2
| 
| on machine2 have a .forward that looks like:
| \user
| user-local at machine1
| 
| on machine1 have an entry in /usr/lib/aliases that looks like
| user-local: \user
| 
| I dont there is there is an easy way to avoid a mail loop without doing it
| this way.

How about...

$HOME/.forward:
	"\user,|$HOME/.forwarder"

$HOME/.forwarder: (mode 755)
	if tee /tmp/forw.$$ | grep -s "From: $USER at othermachine"
	then :
	else mail $USER at othermachine </tmp/forw.$$
	fi
	rm /tmp/forw.$$

The "grep" would have to be adjusted to discover mail from the other
machine.  And yes, it is a bit of a kluge, because mail cc:'ed this
way from the other machine has a bad 'from' line until you have
adjusted it, but hey, at least it doesn't require adding new aliases
in /usr/lib/aliases (which some of us do not have access to).
-- 
Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095
on contract to BiiN (for now :-), Hillsboro, Oregon, USA.
ARPA: <@iwarp.intel.com:merlyn at intelob.intel.com> (fastest!)
MX-Internet: <merlyn at intelob.intel.com> UUCP: ...[!uunet]!tektronix!biin!merlyn
Standard disclaimer: I *am* my employer!
Cute quote: "Welcome to Oregon... home of the California Raisins!"



More information about the Comp.unix.questions mailing list