[comp.mail.misc] How can I bounce my mail from one site to another automatically?

david@ms.uky.edu (David Herron -- One of the vertebrae) (11/12/89)

In article <925@kcdev.UUCP> gentry@kcdev.UUCP (Art Gentry) writes:
>In article <7306@ingr.com>, fordke@ingr.com (Keith Ford x8614) writes:
>> 
>> I read news, reply to news, and post news from uunet!ingr but my
>> base system is at uunet!ingr!b23b!dragon.  How can I have mail
>> that is sent to uunet!ingr automatically bounced to my base?
>> 
>This is easy.  Just have the system administrator at ingr create a file in
>/usr/mail with your id as the file name.  In the file place the following 
>line:
>      Forward to !b23b!dragon!{your id here}

This is a SysV-ism.  And, besides, you don't need that leading "!".
I'm not sure why it's there but I see lots of people use it.  It's
not required by any software with which I'm familiar ...

On Sendmail machines you instead place a ".forward" file in your home
directory which gives an address to which to send the mail.  I believe
you can also pipe into a process from the ".forward" file.

On MMDF sites you can do some rule-based matching on various
header lines and have actions available which will junk the
message, append it to a file, or pipe it into a process.  The
same file & file-format work with "mh" users.

(MMDF will "soon" Officially develop the ability to directly
use ".forward" files much the same way that Sendmail uses them.
A difference is that the piping format will be "user|command"
instead of "|command"..  er.. I guess I'd better check that
for security vilations, oughtn't I?  :-)  ).

I'm sure "deliver" has something neat and wonderful which that
Chip fella will tell us about.

On most of the "useful" mail systems (i.e. *NOT* the lack of
mail system you have on SysV) you can also arrange with the
system admin/postmaster critter to add an alias for you
which will cause mail to alias@such-and-so to be sent to
wherever the alias points.


>> sub-question:  How can I change the From header field?


If you're using 'rn' there's an environment variable and/or
"dot" file in your dot directory which lets you specify the format
of news and mail headers.  This *only* works with rn.  Look at
the man page for more details, I just remember that you *can* do it.
-- 
<- David Herron; an MMDF guy                              <david@ms.uky.edu>
<- ska: David le casse\*'      {rutgers,uunet}!ukma!david, david@UKMA.BITNET
<- 
<- New official address:  attmail!sparsdev!dsh@attunix.att.com

tneff@bfmny0.UU.NET (Tom Neff) (11/12/89)

In article <13209@s.ms.uky.edu> david@ms.uky.edu (David Herron -- One of the vertebrae) writes:
>I'm sure "deliver" has something neat and wonderful (for forwarding) which that
>Chip fella will tell us about.

(Perhaps rashly jumping in for Chip...)

Deliver is for local delivery.  On Sys V boxes it works best in company
with Smail 2.5.  The latter supports forwarding in the Sys V manner,
i.e., /usr/mail/foo contains "Forward to machine2!foo".

You could also bypass Smail's forwarding and do it in Deliver.  The
thing to keep in mind about Deliver is that the C program itself is BABY
simple, almost no bells and whistles.  All in the blooming world it does
is let YOU route stuff YOUR way using shell scripts -- as creatively or
stupidly as you feel like coding 'em.  If you wanted to translate
everything to Pig Latin and store it ROT13'd in a local newsgroup, no
problem.
-- 
 1955-1975: 36 Elvis movies.  |  Tom Neff
 1975-1989: nothing.          |  tneff@bfmny0.UU.NET

chip@ateng.com (Chip Salzenberg) (11/14/89)

In article <7306@ingr.com>, fordke@ingr.com (Keith Ford x8614) writes:
>
> I read news, reply to news, and post news from uunet!ingr but my
> base system is at uunet!ingr!b23b!dragon.  How can I have mail
> that is sent to uunet!ingr automatically bounced to my base?

According to david@ms.uky.edu (David Herron -- One of the vertebrae):
>On Sendmail machines you instead place a ".forward" file in your home
>directory which gives an address to which to send the mail.  I believe
>you can also pipe into a process from the ".forward" file.

The ".forward" feature is supported by Sendmail, Smail 2.5 and Smail 3.
Sendmail and Smail 3 support pipe aliases in ".forward" and elsewhere.
Smail 2.5 doesn't do pipes; if you want them you should get Deliver 2.0.
But even with Deliver installed I just use the ".forward" file for simple
forwarding, since Deliver doesn't know about "user@host" (yet :-)).

>On MMDF sites you can do some rule-based matching on various
>header lines and have actions available which will junk the
>message, append it to a file, or pipe it into a process.  The
>same file & file-format work with "mh" users.

This is rather like what Deliver has, except that Deliver's behavior isn't
rule-based.  Rather, Deliver runs a user-written shell script to determine
what to do, or sometimes actually to do it.  For example:

	:
	# /usr/sample/.deliver

	user="$1"

	# I don't want mail about AMWAY
	# (I use the "header" utility, included with Deliver)

	if header -f subject $HEADER | grep -si "amway"
	then
	     echo DROP
	     exit
	fi

	# On weekends, forward this mail to the home machine

	case `date "+%w"` in
	0|6)    echo "homesite!myname"; exit ;;    # Deliver knows about UUCP
	esac

	# Okay, just drop it in my default mailbox.

	echo "$user"

>I'm sure "deliver" has something neat and wonderful which that
>Chip fella will tell us about.

In all honesty, I wasn't going to say anything until I saw this.  :-)
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering;  <chip@ateng.com> or <uunet!ateng!chip>

davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (11/15/89)

In article <7306@ingr.com>, fordke@ingr.com (Keith Ford x8614) writes:
|  
|  I read news, reply to news, and post news from uunet!ingr but my
|  base system is at uunet!ingr!b23b!dragon.  How can I have mail
|  that is sent to uunet!ingr automatically bounced to my base?

  Without going to a machine with maps and checking I don't know what
software these machines run, but here are some suggestions.

  If ingr is a BSD machine just create a .forward file in your home
directory with the line b23b!dragon in it.

  If ingr is a SysV machine running sendmail, same thing.

  If ingr is running smail have a global alias installed.

  If ingr is running deliver consult a guru for a forwarding incantation.
|  
|  sub-question:  How can I change the From header field?

  Since this gets mangled by a lot of mailers your best bet might be to
persuade your mailer to use a "Reply-To:" field instead. Most mailers
will reply to that field if it is present.
-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon

dg@lakart.UUCP (David Goodenough) (11/17/89)

From article <255EF9BF.14590@ateng.com>, by chip@ateng.com (Chip Salzenberg):
> But even with Deliver installed I just use the ".forward" file for simple
> forwarding, since Deliver doesn't know about "user@host" (yet :-)).

Wait a minute - you can get /bin/sh to crunch mail with deliver. It strikes
me that with perl (running in a shell script) and deliver working hand in
hand, you ought to be able to extract the address, parse it, and decide
what to do with it. Now you _CAN_ grok user@host, uucphost!user,
host.subdomain.domain!user, etc. etc. etc.

Come to that, with some REAL creative genius, I could see deliver replacing
smail / sendmail ..... (Now, come on David, stop dreaming :-) )
-- 
	dg@lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp@xait.xerox.com			  +---+

chip@ateng.com (Chip Salzenberg) (11/18/89)

According to davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr):
>In article <7306@ingr.com>, fordke@ingr.com (Keith Ford x8614) writes:
>|  I read news, reply to news, and post news from uunet!ingr but my
>|  base system is at uunet!ingr!b23b!dragon.  How can I have mail
>|  that is sent to uunet!ingr automatically bounced to my base?
>
>  If ingr is running smail have a global alias installed.

Or use the .forward file.

>  If ingr is running deliver consult a guru for a forwarding incantation.

[Sitting in the Lotus position, I write:] In your delivery file ".deliver",
either echo the address you want to receive the mail:

	echo "forwarding!address"

or pipe it to Smail if Deliver won't grok your address:

	cat $HEADER $BODY | smail address@forwarding.domain
	echo DROP

-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering;  <chip@ateng.com> or <uunet!ateng!chip>
    "Did I ever tell you the Jim Gladding story about the binoculars?"

chip@ateng.com (Chip Salzenberg) (11/21/89)

According to dg@lakart.UUCP (David Goodenough):
>According to chip@ateng.com (Chip Salzenberg):
>> But even with Deliver installed I just use the ".forward" file for simple
>> forwarding, since Deliver doesn't know about "user@host" (yet :-)).
>
>Wait a minute - you can get /bin/sh to crunch mail with deliver.

Well, yes.  But then, it's the _delivery_file_ that understands "user@host".
Deliver itself understands "host!user" -- it runs uux -- but it doesn't
understand "user@host".

So, unless you've written a smart post-user delivery file, "echo user@host"
won't work very well in a user delivery file.

>Come to that, with some REAL creative genius, I could see deliver replacing
>smail / sendmail ..... (Now, come on David, stop dreaming :-) )

Really, that wouldn't be too hard.  At least, replacing Smail 2.5 wouldn't
be too hard.  Smail 3 -- well, who'd want to re-implement that? :-)
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering;  <chip@ateng.com> or <uunet!ateng!chip>
    "Did I ever tell you the Jim Gladding story about the binoculars?"