[comp.mail.mush] Can I use the "filter" program? Probably.

wyle@inf.ethz.ch (Mitchell Wyle) (06/05/89)

In article <14320@pasteur.Berkeley.EDU> 
dheller@cory.Berkeley.EDU.UUCP (Dan Heller) writes:
>In article <1989Jun1.193715.908@ateng.ateng.com> 
>chip@ateng.ateng.com (Chip Salzenberg) writes:
>> According to jeff@cjsa.WA.COM (Jeffery Small):
>> >I am running smail 2.5 under elm and need to automatically forward a set of
>> >mail messages which match a certain pattern, to another site.  Is there any
>> 
>> IMHO, a better solution is the "deliver" program, which by some mysterious

What's IMHO?

>Why is a separte program necessary?  

Because I interpret Jeff's request to mean he wants the mail forwarded
when it arrives, *not* when he starts his mail reader.

>to issues like this.  but in mush, all you have to do is:
>
>pick -s "pattern" | mail -f <address>
>
>This forwards all messages matching a particular pattern to another site.
>Dan Heller	<island!argv@sun.com>

If Jeff can live with the messages' being forwarded only after he starts
his mailer, you could do it in BSD mail, mailx, elm, mush, mm, mh, m6,
vi, ... or whatever.  If he wants smail to forward the messages for
him, all he needs is a .forward file.  See the man page forward(5) and
the docs which come with smail.  It always surprizes me how many people
re-invent what .forward does.

BTW:  I recommend that Jeff use the "forward" system which comes with elm.
      I think smail will read his .forward file to start elm's filter
      program.

Something like:

   ~/.forward
      |"bin/DoMail ; exit 0"

   ~/bin/DoMail
      trap /bin/rm -f $f
      f=/tmp/DM_$$
      cat > $f
      ANS=`egrep "pattern1|pattern2|pattern3" $f
      if [ "$ANS"x != x ]; then
        /usr/ucb/mail jeff@grimble.toad.over.under.bang.slam.bam.edu < $f
      fi
      /bin/rm -f $f

[m6 is: Mitch's Minimal Mail Message Manipulatin Mechanism, a long, slow
 set of vi macros The project is dying because mush is getting so damn
 good].
-- 
-Mitchell F. Wyle
Institut fuer Informationssysteme         wyle@inf.ethz.ch 
ETH Zentrum / 8092 Zurich, Switzerland    +41 1 256 5237