[comp.mail.elm] filter rule won't work

aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug) (02/20/91)

I'm trying to write a filter rule to move messages of this form:

  Received: by shrike.Austin.Lockheed.COM (4.1/1.49); Tue, 19 Feb 91 14:39:12 CST
  From: Daniel A Haug <aihaug@AUSTIN.LOCKHEED.COM>
  Message-Id: <9102192039.AA10872@shrike.Austin.Lockheed.COM>
  Subject: news status
  To: aihaug (Daniel A Haug)
  Date: Tue, 19 Feb 91 14:39:11 CDT
  ...

into a specific folder.  Here is the rule I wrote to try to do this:

if [from = "Daniel A Haug" and subject = "news status"] then
   save "/usr6/aihaug/Mail/news-status"


Its not working.  filter -s says that all messages are being processed
by the default rule.  filter -r says:

Rule 1:  if (from = "Daniel A Haug" and subject = "news status") then
	  Save /usr6/aihaug/Mail/news-status

Here is my .forward file:
    "| /usr7/pd/bin/filter -vo /tmp/aihaug.filter_errors"

My filter errors file has one each of this line:
   filter (aihaug): Mailing message to aihaug

What am I doing wrong?  I'm using Elm2.2 PL16.

Another question about filters: as soon as I started using this,
I no longer get biff-type notification at my terminal when new
mail has arrived.  Is there a way to still get notified for most
of my mail?

thanks,

dan haug-- 
Internet: haug@austin.lockheed.com
UUCP:     ut-emx!lad-shrike!aihaug
Phone:    (512) 386-4634

navarra@casbah.acns.nwu.edu (John Navarra) (02/20/91)

In article <490@shrike.AUSTIN.LOCKHEED.COM> aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug) writes:
>
>I'm trying to write a filter rule to move messages of this form:
>
>  Received: by shrike.Austin.Lockheed.COM (4.1/1.49); Tue, 19 Feb 91 14:39:12 CST
>  From: Daniel A Haug <aihaug@AUSTIN.LOCKHEED.COM>
>  Message-Id: <9102192039.AA10872@shrike.Austin.Lockheed.COM>
>  Subject: news status
>  To: aihaug (Daniel A Haug)
>  Date: Tue, 19 Feb 91 14:39:11 CDT
>  ...
>
>into a specific folder.  Here is the rule I wrote to try to do this:
>
>if [from = "Daniel A Haug" and subject = "news status"] then
>   save "/usr6/aihaug/Mail/news-status"
>
         do this:
   if (from contains "aihung@wherever" and subject contains "news status" )
      then save "/whereever"

 this worked fine for me -- just dont use "Daniel A Hung " but the username
 instead. Your .forward file is fine.

>
>Another question about filters: as soon as I started using this,
>I no longer get biff-type notification at my terminal when new
>mail has arrived.  Is there a way to still get notified for most
>of my mail?

     I played around with this one for a while. First of I am using Elm 2.3 and
 I am running bash (yeah bash!) as my shell but this should not make a differ-
 ence in the following description.
	As far as biff is concerned, I don't think you can get it to look   
anywhere but the usual place to notify you about mail. Therefore, I used 
newmail-- which you should have if you are running 2.2.
	I did this:
       I changed my MAILPATH=/usr/spool/mail/navarra:/home/u3/navarra/Mail
and put a line like /usr/local/bin/newmail $HOME/Mail in my .bash_profile
so newmail knows to check this directory (because that is where filtered 
mail is kept)
	Now when I sent myself mail using a filter rule which saved mail
in $HOME/Mail/test I DID NOT get notified of new mail!! SO what I did was
to include the file test in my MAILPATH and then i was notified that I got
mail. The only problem is that as far as I know, you would have to specify
a file for each message. I could be wrong on this but if anyone knows for
sure, please answer this.
	Just remember that if you try this, the default check on newmail is
60 sec so you can either change the interval (which I recommend if you are
going to try it).


Good luck -- trust me with a little tinkering it works!!

----------------------
from the lab of the MaD ScIenTISt
navarra@casbah.acns.nwu.edu


>
>thanks,
>
>dan haug-- 
>Internet: haug@austin.lockheed.com
>UUCP:     ut-emx!lad-shrike!aihaug
>Phone:    (512) 386-4634

navarra@casbah.acns.nwu.edu (John Navarra) (02/20/91)

>	Now when I sent myself mail using a filter rule which saved mail
>in $HOME/Mail/test I DID NOT get notified of new mail!! SO what I did was
     
        well now that I have played with this a bit more, perhaps you don't
need to specify an exact filename for newmail. I think I originally got my
MAILPATH wrong. So just make sure your MAILPATH variable is set up right to
check all mail directories.
My bad -- but this just makes the solution that much better :-)


if anyone else has success with this doing it a different (or easier) way,
let me know.
>
>----------------------
>from the lab of the MaD ScIenTISt
>navarra@casbah.acns.nwu.edu
>

rudolf@curano.imp.com (Rudolf Kuenzli) (02/20/91)

In <490@shrike.AUSTIN.LOCKHEED.COM> aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug) writes:

>if [from = "Daniel A Haug" and subject = "news status"] then
>   save "/usr6/aihaug/Mail/news-status"

I did run in the same problem, when I started with filter first. Anyway,
filter in your case is testing 'From:' if it's round else it will test
'From'. You are probably running a sophisticated mail system and
therefor 'From:' ist checked. "Daniel A Haug" shows up in the 'From'
line and not in the 'From:'. And that makes the result of the test
false.

Trye once with:

(from = "haug@austin" and subject = "news status") ? save ....

and test it. In my case it did work.


>Another question about filters: as soon as I started using this,
>I no longer get biff-type notification at my terminal when new
>mail has arrived.  Is there a way to still get notified for most
>of my mail?

Sorry, I don't know anything about biff...			

-- 
Don Curano The Magician 		  In real life: Rudolf Kuenzli
Mail Address: rudolf@curano.imp.com	  
Employer: What's that good for? 	  Occupation: Any need for?

aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug) (02/22/91)

First, thanks for all of the responses to my filter rules problem.
Now my rules are correctly working.  Unfortunately, there is
something happening for the "default" case.  The rest of my
mail now seems to get appended into a single message.  That is,
say I have received 5 new messages, when invoking elm to read
them, they all show up in one message.  Any ideas?  I looked
at the mail spool file, and the headers seem to be the same
as they were before.  This only starts happening when I turn
on the filter process (I guess via the .forward file).  I've
included sample headers from before I starting using the filter
program, and after.  Whereas my /usr/spool/mail file contains
several messages, only the messages received since using the
filter program are "concatenated" together.

Any suggestions are greatly appreciated.

thanks,

dan haug
Internet: haug@austin.lockheed.com
UUCP:     ut-emx!lad-shrike!aihaug
Phone:    (512) 386-4634

==================== header before after filter rules ==================

From milano!root Mon Feb 18 11:30:31 1991
Received: by shrike.Austin.Lockheed.COM (4.1/1.49); Mon, 18 Feb 91 11:30:29 CST
Date: Mon, 18 Feb 91 11:29:45 -0600
From: Super-user Milano <milano!milano!root>
Message-Id: <9102181729.AA07415@milano.sw.mcc.com>
Received: by milano.sw.mcc.com (5.61/STP1.56) 
	id AA07415; Mon, 18 Feb 91 11:29:45 -0600
Apparently-To: lad-shrike!lad-shrike!news
Status: O

remote execution	[uucp job shrikeNed69 (2/18-11:29:43)]
	rnews 
exited normally


==================== header before using filter rules ==================

Received: by shrike.Austin.Lockheed.COM (4.1/1.49); Thu, 21 Feb 91 15:02:00 CST
Date: Thu, 21 Feb 91 14:56:21 -0600
From: Super-user Milano <milano!milano!root>
Message-Id: <9102212056.AA27693@milano.sw.mcc.com>
Received: by milano.sw.mcc.com (5.61/STP1.56) 
	id AA27693; Thu, 21 Feb 91 14:56:21 -0600
Apparently-To: lad-shrike!lad-shrike!news

remote execution	[uucp job shrikeNf072 (2/21-14:56:17)]
	rnews 
exited normally

=====================================================================-- 
Internet: haug@austin.lockheed.com
UUCP:     ut-emx!lad-shrike!aihaug
Phone:    (512) 386-4634

protofan@motcid.UUCP (Mike S. Protofanousis) (02/23/91)

From article <492@shrike.AUSTIN.LOCKHEED.COM>, by aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug):
> 
> The rest of my
> mail now seems to get appended into a single message.  That is,
> say I have received 5 new messages, when invoking elm to read
> them, they all show up in one message.  Any ideas?  I looked
> at the mail spool file, and the headers seem to be the same
> as they were before.  This only starts happening when I turn
> on the filter process (I guess via the .forward file). 

This has also happened to me.  The problem is with filter.  If you
are getting multiple messages simultaneously and have multiple
sendmail/filter processes running at the same time, it sometimes
causes your mail spool file to get corrupted.

I am using Smail3.1.19 and Elm2.3.11.  I had to add 2 lines of code
to the filter source, and all my problems went away.  

I once tried to get this "feature" fixed, but it requires more than
2 lines of code to work in a networked environment.  On the other
hand, if you are using a stand-alone machine and would like more
info I would be glad to assist.

-- 
Mike Protofanousis 
msp@pronet.chi.il.us
uunet!motcid!protofan