procmail
[Top] [All Lists]

collecting variables

1999-11-20 14:16:45
Hi,

I'm tired of checking things like sender, subject, presence of
daemons, X-Loops, etc., in multiple recipes and want to do all
the checking at the beginning.

I want to know certain things, such as sender, subject, and
addressee.  The latter seems the hardest of these.  As for
the first two, I know I could use formail, as in



  FROM=`formail -zrx To: | sed 's/@netcom[0-9].*/@netcom.com/'`
  SUBJ=`formail  -zx Subject:`

I'm still not comfortable with the "newer" MATCH stuff; but
I suspect from what goes on on this list that using it would be
better.  I think maybe it will work for TO also.  Can someone
help?

I was able to use the below for finding the addressee, but
it has various flaws, not tle least of which is if the addressee
is not in the To: line or if there are multiples.

  TO  =`formail  -zx To: | sed 's/[<>]//g'`

One problem I want to solve with this is that I get mail for
six domains all filtered through one.  I want to be able
to do similar things but, for example, auto-reply with the
name of the proper domain (the one that was addressed).

So: 

1) If mail sent to @domain1 use domain1 in
        a) auto-reply (if any)
        b) X-Loop (if (a))
        c) logs

2) If mail also sent to @domain2 through domain6
   reprocess those things?  Probably, but I have
   to think more about this.

Anyway, I know I could do

        :0c
        * TO(_at_)domain1
        | whatever for domain1

        :0c
        * TO(_at_)domain2
        | whatever for domain2

Etc.  But that is rather ugly.  Isn't there a
way to tell up-front what domain it was intended for
so that one recipe can deal with any or all of them
flexibly?  That's what I want.


-- 
    \     .-.     .-.     .-.     .-.     .-.     .-.     .-.     /
     \-d-/-m-\-a-/-n-\-(_at_)-/-n-\-e-/-t-\-c-/-o-\-m-/-.-\-c-/-o-\-m-/
      '-'     '-'     '-'     '-'     '-'     '-'     '-'     '-'

<Prev in Thread] Current Thread [Next in Thread>
  • collecting variables, Dallman Ross <=