procmail
[Top] [All Lists]

Re: Setting and Checking Environment Variables.

1996-09-30 05:30:06
    > To complete my project I need an example of setting and comparing 
environment variables and am unsure of how to do this...
    > 
    > SENTAIL=NO

Unless this is a typo, shoudn't your variables all be the same?
And, unset it by default, rather than set it to *no*.

    SENTMAIL

    > :0 c
    > * ^TOcrjones
    >  {
    >  :0 c
    >  ! crjones(_at_)wizard(_dot_)com
    >  SENTMAIL=YES
    >  }
    > ...
    > :0
    > *NO.*SENTMAIL
    > !crjones(_at_)wizard(_dot_)com

To test a variable, (please read the man page for "procmailrc"),
use "??".  Eg:

    :0
    * SENTMAIL ?? yes
    !crjones(_at_)wizard(_dot_)com

If your recipes aren't very fancy (and by that I mean
they don't do multiple deliveries or actions), then you can
use the "LASTFOLDER" variable, which procmail sets automatically
for you whenever a delivering recipe action is invoked.

    :0c
    * ^TOcrjones
    ! crjones(_at_)wizard(_dot_)com

    :0c
    * ^TOidiots
    ! larry moe curry

    ... more conditional copies

    # Any deliveries?  If not, send here by default
    :0
    * LASTFOLDER ?? .
    ! crjones(_at_)wizard(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>