[comp.mail.elm] Filter question

rahard@eeserv.ee.umanitoba.ca (Budi Rahardjo) (11/25/90)

Is there a way I can use "Reply-To" and "Sender" fields with
"filter" ? I'd like to check these fields and perform different
actions.

-- budi
--
Budi Rahardjo                 <rahardj@ccu.umanitoba.ca>
<rahard@ee.umanitoba.ca>   <rahard@budi.ee.umanitoba.ca>
Electrical Engineering - University of Manitoba - Canada

navarra@casbah.acns.nwu.edu (John 'tms' Navarra) (04/24/91)

      I have a question about filters. We have a system wide alias 'cons'
 on our system and there are a whole bunch of names associated with it. 

 Now recently, someone sent a message to cons, name, name2, name3, etc
 and I did not get the letter.

 I wonder if the problem could be because the To: line was too long to be
 filtered or if a problem would arise if two separate conditions were fulfilled
 in the To: line?

 either way, I didn't receive the message -- and it was not recorded in my
 filter.log.      

 Any ideas?


-- 
From the Lab of the MaD ScIenTiST:
      
navarra@casbah.acns.nwu.edu

anoosh@cray.com (Anoosh Mostaghimi) (05/21/91)

I need a set of filter rule(s) or a clever "execute" to be able 
to based on a given "To:" field of a mailing list to *bounce* a 
copy of that email to several other folks and still keep a copy 
of that email in my /usr/spool/mail.


Thanks for your help|suggestion.

---
Anoosh Mostaghimi
anoosh@cray.com  || ...!uunet!cray!anoosh 

das@trac2000.ueci.com (David Snyder) (05/23/91)

In article <225835.4481@timbuk.cray.com>, anoosh@cray.com (Anoosh Mostaghimi) writes:
> 
> I need a set of filter rule(s) or a clever "execute" to be able 
> to based on a given "To:" field of a mailing list to *bounce* a 
> copy of that email to several other folks and still keep a copy 
> of that email in my /usr/spool/mail.
>
Sounds like you want "forwardcopy".

Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip
# forwardcopy
# forwards a COPY of mail to others
# usage: forwardcopy mailbox forwarder(s)...

MAILBOX=$1; shift
FORWARDERS=$*
TMPMAIL=/tmp/tmpmail$$

# Put mail in a tmp file and extract the subject
cat >$TMPMAIL
set `grep "^Subject:" $TMPMAIL`; shift; SUBJECT="$* (fwd)"

# Copy contents of TMPMAIL to mailbox
cat $TMPMAIL >>/usr/mail/$MAILBOX

# Send contents of TMPMAIL to FORWARDERS
elm -s "$SUBJECT" $FORWARDERS <$TMPMAIL

# Clean up when done
rm -f $TMPMAIL
Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip

DAS
-- 
David A. Snyder @ UE&C - Catalytic in Philadelphia, PA

UUCP:  ..!uunet!trac2000!das     INTERNET:  das@trac2000.ueci.com

johnr@lotus.lotus.com (John Rouillard) (05/24/91)

In article <225835.4481@timbuk.cray.com>, anoosh@cray.com (Anoosh Mostaghimi) writes:
|> 
|> I need a set of filter rule(s) or a clever "execute" to be able 
|> to based on a given "To:" field of a mailing list to *bounce* a 
|> copy of that email to several other folks and still keep a copy 
|> of that email in my /usr/spool/mail.

This won't *bounce* the message, filter only handles forwarding as far as I can
tell, but if forwarding is good enough - try something along the following lines:

RULE 1:
  if ( To = "FTest" and from = "johnr") then
        save "/usr/spool/mail/fooble"
 
RULE 2:
  if ( To = "FTest" ) then
        forward "frisbele@einstein myself@einstein others@anywhere.usa.com"

The first time through, the message isn't from you, so rule 2 is invoked sending
the mail to the interested parties, including yourself.  The next time through,
you did send (forward) the message so rule 1 is invoked, and the message is
saved.  This works OK unless you originated the message, in which case it only
gets saved not forwarded.  Rule 1 MUST come before rule 2 otherwise, you will
never save the message, and will create an inifinite loop of forwarded messages.

I don't acutally use the configuration above, I use the subject line instead of
the to line, and save it in a file that isn't my spool file.

Obviously, this won't work if the message is bounced, since rule 1 wouldn't be
executed.

If you had a reflector that would bounce the message, then a simple shell script
that has:

     cat - > /tmp/$$

as its first line to capture the message, and then proceeds with:

    cat /tmp/$$ >> /usr/spool/mail/fooble
    boing azzy, bazzy, grumpy@any < /tmp/$$

where boing is your mail bouncer.  I am not sure if you could write a script for
elm and submit it by redirecting stdin, but that may work, to create a mail
bouncer.  Just invoke elm as "elm -f /tmp/$$" and the input script would be along
the lines of:

	b<to_names_here>y




On more or less the same note, does anybody have patches that allow multiple
actions to be tagged to the same pattern.  Then this would be a simple case of 

   if (subject = "Forward Test" ) then do
          save "/usr/spool/mail/fooble"
          forward "frisbee@einstein others@anywhere.usa.com"
	  execute boing to@these.people etc@you.get.the.idea
	  done

or something like this. It is really useful to be able to save a message and run it through a program as well.  Ideally a bounce primative would work well.


On a completely different note:
  Why does filter not like strings with "_"'s in them.  It seems to use '_'
  as a delimiter of some sort. I fixed this in my filter by using ^A instead of
  '_' as a delimeter, but I don't think that is a good solution.


		-- John

itkin@mrspoc.Transact.COM (Steven M. List) (05/27/91)

anoosh@cray.com (Anoosh Mostaghimi) writes:

>I need a set of filter rule(s) or a clever "execute" to be able 
>to based on a given "To:" field of a mailing list to *bounce* a 
>copy of that email to several other folks and still keep a copy 
>of that email in my /usr/spool/mail.

As much as I love Elm and its buddies, this is not something that is
reasonable for a Mail User Agent, even one with healthy utilities like
Elm's.  Rather, it makes sense for the Mail Transport Agent to handle
stuff like this.  Using either Smail or Sendmail, you can create an
alias for the "To:" field and have it automatically route the mail to
as large a list of people as you wish.
-- 
 +----------------------------------------------------------------------------+
 :                Steven List @ Transact Software, Inc. :^>~                  :
 :           Chairman, Unify User Group of Northern California                :
 :                         itkin@Transact.COM                                 :