procmail
[Top] [All Lists]

Re: How to?

1997-05-14 13:29:00
Thank you, that worked.

One more question:

I want to be able to use that rc file from /etc/aliases. Something
like:

testacct:       | "/usr/local/bin/procmail -m /home/testuser/rc1"

Instead of checking the Subject with:

        * ^Subject:.*TEST1*

I want to check the To field with:

        * ^TOtestacct

But when I call procmail like that from the /etc/aliases file,
procmail fails to check the To: field. How can I pass the To: field to
procmail? ( | "/usr/local/bin/procmail -m /home/testuser/rc1 -d testacct"
didn't work.)

I need to check the To: field, because that rc file (rc1) is going to
be used by more than one address.

Thanks again.

-Erdem Ozsaruhan
NSF Postmaster

Philip Guenther writes:
Erdem Ozsaruhan <eozsaruh(_at_)nsf(_dot_)gov> writes:
I want to be able to send a message to user1 if a message has a
subject with TEST1 in it and the message comes from testuser.

But if the massage has a Subject line with TEST1 in it but does not
come from testuser, I want to send a message to user2.

And if the subject does not have TEST1 in it regardles where it comes
from, I want the message go to the $DEFAULT and to user3.

Is this possible?

something like:

DEFAULT=$HOME/mbox

:0            
* ^Subject:.*TEST1*
{
    * ^From.*testuser*   (I know this is not allowed, that's my problem!)
    :0
    !user1
    :0 E
    !user2
}

And somewhere I have to use !user3 ...

Almost had it.  Your largest problem was that you missed the placement of
the condition on the nested recipe.  Remember: inside the braces is just
a normal series of recipes and assignments:

      DEFAULT = $HOME/mbox
      :0
      * ^Subject:.*TEST1
      {
          # Use \< and \> to delineate the address so that "testuser2"
          # doesn't match.
          :0
          * ^From.*\<testuser\>
          ! user1

          # If that didn't match, send it to user2.  If it did, we wouldn't
          # be here at all, so no need for the 'E' flag.
          :0
          ! user2
      }

      # send a copy of user3
      :0 c
      ! user3


Does that all make sense?

Philip Guenther

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