procmail
[Top] [All Lists]

Re: Setting and Checking Environment Variables.

1996-10-02 03:18:16
    > Alan,
    > Sorry to ask directly,..

That's ok.  Just buy me a lunch sometime. :^)

    >                       ..but does this theoriticly work?
    > :0c
    > *^TOsupport
    > {
    >  :0c
    >  !address1
    >  :0c
    >  !address2
    > }

The combination of a nested block and the 'c' flag causes procmail to
fork a child process for the nested block, while the parent skips over
it and continues on.  The child process doesn't necessarily stop unless
a *delivering* recipe (without the 'c' flag) action succeeds.  

In your recipe above, the child process will send mail to the two
addresses, and then, because the delivering recipes were of the 'copy'
kind, keep going along with the parent in the recipe below.  I don't
think this is what you intended.

    > :0
    > * LASTFOLDER ?? .
    > ! address1

I think you mean to say here "! LASTFOLDER ?? .", which means
if LASTFOLDER is *not* set, then deliver here.

Note: you can have multiple addresses on the delivery of a forward
action.

Here is how I would write these two recipes:

    :0c
    * ^TOsupport
    ! address1 address2

    :0 E
    ! address1

The 'E' flag says to do this "else" recipe only if the preceeding
recipe failed its condition tests.  You can string a bunch of "else" 
recipies along.  For example:

    :0c
    * ^TOsupport
    ! address1 address2

    :0Ec
    * ^TOrequest
    ! reqaddr1 reqaddr2 reqaddr3

    :0Ec
    * ^TOsomeotherlist
    ! other1 other2 other3 ...

    :0 E
    ! address1

Now this seems to look okay, but what happens if a piece of mail is
addressed to two or more of these lists, eg:

    To: support, request

Then, the recipes should be written this way:

    :0c
    * ^TOsupport
    ! address1 address2

    :0c
    * ^TOrequest
    ! reqaddr1 reqaddr2 reqaddr3

    :0c
    * ^TOsomeotherlist
    ! other1 other2 other3 ...

    :0
    * ! LASTFOLDER ?? .
    ! address1

which will deliver to the various list members, if addressed in the
mail, otherwise, the mail will be delivered to "address1".

All of this is in the man page for "procmailrc".  I'll bet that if you
read it again, after having these hints, you'll get a much better
understand now.

BTW, This looks a lot like a mailing list front-end.  If you are
implementing a mailing list, then you really should consider using
SmartList, which does all this stuff and more, including handling
digests, archives, MIME-stuff, etc.  SmartList is based on procmail and
written by the same author.

G'luck.

___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com>      http://reality.sgi.com/aks

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Setting and Checking Environment Variables., Alan K. Stebbens <=