[comp.unix.questions] Is there a way to forward and keep mail?

mbonner@oscar.UUCP (Matt Bonner) (10/18/90)

Okay, that subject isn't very well worded.  What I want to do
is have incoming mail go to two places.  For example, someone
mails me at this address (mbonner@oscar.hns.hac.com), and one
copy of the message will stay here, and one copy will go to
another account.  If you think most people don't care, email
me and i will post a summary.

Thanks (i hope) in advance,
matt

epeterso@houligan.encore.com (Eric Peterson) (10/18/90)

mbonner@oscar.UUCP (Matt Bonner) writes:

| Okay, that subject isn't very well worded.  What I want to do
| is have incoming mail go to two places.  For example, someone
| mails me at this address (mbonner@oscar.hns.hac.com), and one
| copy of the message will stay here, and one copy will go to
| another account.

This can be done quite easily if you're on a site that uses Sendmail,
one of the most common mail transport agents in the Unix world.
Simply create a file called ".forward" in your home directory that
contains the following line (including the quotation marks):

   "| tee /usr/spool/mail/mbonner | mail other-acct@host.domain"

This will do exactly what you want -- save a copy of your incoming
message to your normal incoming mailbox as well as send a copy of that
mail to another account.

You can have Sendmail feed each message you get into any program you
want using this construct.  Just insert your favorite Unix command in
place of the "tee ... | mail ..." part above.  Just make sure that you
put quotation marks around it and that the first character inside the
quotes is "|".

Apparently there are some versions of Sendmail that do not support
this feature, although I don't know enough about Sendmail to be able
to tell you by version number whether or not it would work.  The best
way to find out is to try it.

Eric
--
       Eric Peterson <> epeterson@encore.com <> uunet!encore!epeterson
   Encore Computer Corp. * Ft. Lauderdale, Florida * (305) 587-2900 x 5208
Why did Constantinople get the works? Gung'f abobql'f ohfvarff ohg gur Ghexf.

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (10/19/90)

In article <epeterso.656267220@houligan> epeterson@encore.com (Eric Peterson) writes:
> Simply create a file called ".forward" in your home directory that
> contains the following line (including the quotation marks):
>    "| tee /usr/spool/mail/mbonner | mail other-acct@host.domain"

Don't do this! tee will overwrite the mailbox on every new piece of
mail. tee -a is implemented incorrectly on some systems. And the mailbox
format is probably not just one message after another.

Much better is to have two lines:
\mbonner
other-acct@host.domain

The \ turns off all alias interpretation and forces delivery straight to
your mailbox. This is much more efficient than the above pipe, and it
works.

---Dan

pfalstad@bow.Princeton.EDU (Paul John Falstad) (10/19/90)

In article <epeterso.656267220@houligan> epeterson@encore.com (Eric Peterson) writes:
>mbonner@oscar.UUCP (Matt Bonner) writes:
>This can be done quite easily if you're on a site that uses Sendmail,
>one of the most common mail transport agents in the Unix world.
>Simply create a file called ".forward" in your home directory that
>contains the following line (including the quotation marks):
>
>   "| tee /usr/spool/mail/mbonner | mail other-acct@host.domain"
>
>This will do exactly what you want -- save a copy of your incoming
>message to your normal incoming mailbox as well as send a copy of that
>mail to another account.

Call me stupid, but can't you just make your .forward:

\mbonner, other-acct@host.domain

?

I think even the \ may be superfluous.

--
Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
And Dinsdale said, "You've been a naughty boy, Clement," and splits me nostrils
open, and saws me leg off, and pulls me liver out.  And I said, "My name's not
Clement."  And then he loses his temper.  And he nails me head to the floor.