[comp.mail.misc] 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

chip@ateng.ateng.com (Chip Salzenberg) (06/07/89)

According to wyle@inf.ethz.ch (Mitchell Wyle):
>If [the original poster] wants smail to forward the messages for
>him, all he needs is a .forward file.

Unfortunately, Smail 2.5 does >not< support "|program" aliases, whether in
.forward files or elsewhere.  Smail 3.1 does; in fact, my ".forward" file
contains "|/usr/bin/deliver chip".

If you configure Smail 2.5 to use deliver for local mail (the LMAIL macro),
then your delivery files (being shell scripts) can do whatever you like with
incoming mail when it arrives.
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg         |       <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering         |       Me?  Speak for my company?  Surely you jest!

bdb@becker.UUCP (Bruce Becker) (06/12/89)

In article <1989Jun7.104600.25715@ateng.ateng.com> chip@ateng.ateng.com (Chip Salzenberg) writes:
|According to wyle@inf.ethz.ch (Mitchell Wyle):
|>If [the original poster] wants smail to forward the messages for
|>him, all he needs is a .forward file.
|
|Unfortunately, Smail 2.5 does >not< support "|program" aliases, whether in
|.forward files or elsewhere.  Smail 3.1 does; in fact, my ".forward" file
|contains "|/usr/bin/deliver chip".

	A person I know has made a simple patch to smail 2.5
	which allows it to support "|program" aliases.

	If people are interested I will try to get him to
	post his changes to tne net.

Cheers,
-- 
   __	 Bruce Becker	Toronto, Ont.
w \cc/	 Internet: bdb@becker.UUCP, bruce@gpu.utcs.toronto.edu
 `/v/-e	 BitNet:   BECKER@HUMBER.BITNET
_<  >_	 "Like, um, it *was* Jimi, I am so sure" - Lily of the Valley Girls

jeff@cjsa.WA.COM (Jeffery Small) (06/12/89)

Thanks to everyone who suggested using "deliver" to solve my mail forwarding
problem.

In article <259@ethz-inf.UUCP>, wyle@inf.ethz.ch (Mitchell Wyle) writes:
> 
> 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.
> 
Just as a point of clarification, my copy of smail 2.5 does not mention or
appear to support the .forward mechanism of sendmail.  I have heard that this
capability will be included in smail 3.x whenever that is released from 
beta testing.
--
Jeffery Small    (206) 485-5596            uw-beaver!uw-nsr!uw-warp
C. Jeffery Small and Associates                                    !cjsa!jeff
19112 152nd Ave NE - Woodinville, WA  98072           uunet!nwnexus

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

According to bdb@becker.UUCP (Bruce Becker):
>According to chip@ateng.com (Chip Salzenberg):
>>Unfortunately, Smail 2.5 does >not< support "|program" aliases, whether in
>>.forward files or elsewhere.  Smail 3.1 does; in fact, my ".forward" file
>>contains "|/usr/bin/deliver chip".
>
>	A person I know has made a simple patch to smail 2.5
>	which allows it to support "|program" aliases.
>
>	If people are interested I will try to get him to
>	post his changes to tne net.

I just want to warn everyone that I did exactly that, once.  However, if the
patch is "simple" then its security must be little or none.  Do you want a
feature if it lets your users execute arbitrary programs as "uucp"?

Instead of hacking on Smail 2.5, I suggest that anyone who wants to pipe
their mail to a program pick up Deliver, a program designed to be used
(among other things) as a back-end to Smail 2.5.  Deliver is robust and was
designed with security in mind.  Further, it automatically splits incoming
messages into two files, the header and the body, for easier processing.
(Yes, they are merged when the mail is delivered.  :-))

And delivery files, which are executed when mail arrives, are shell scripts;
so you can do anything you want in them.
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg         |       <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering         |       Me?  Speak for my company?  Surely you jest!