procmail
[Top] [All Lists]

Re: filterring

2000-04-13 06:03:12

:0:
* ^TOuser(_at_)xyz(_dot_)com
!user

this takes the mail "user(_at_)xyz(_dot_)com" to the "user" local account at 
the linux
host(RH6.11).

You shouldn't use a lock when forwarding a message, so remove the colon
after zero.

What I want is can all the mails 
(user1(_at_)xyz(_dot_)com,user2(_at_)xyz(_dot_)com 0comming at
the account go to a perticular account (say "user")
and also get distributed to the respective local account
e.g
user1(_at_)xyz(_dot_)com goes to local account "user" & "user1"
user2(_at_)xyz(_dot_)com goes to local account "user" & "user2"
user3(_at_)xyz(_dot_)com goes to local account "user" & "user3"

User `user' already has the e-mail, so you only want to forward a copy of
that message and send to userX. So both users will have the message.


:0 c
* ^(To|Cc):(_dot_)*user1(_at_)xyz\(_dot_)com
! user1

:0 c
* ^(To|Cc):(_dot_)*user2(_at_)xyz\(_dot_)com
! user2

:0 c
* ^(To|Cc):(_dot_)*user3(_at_)xyz\(_dot_)com
! user3



or better approach:

:0 c
* ^TO_\/(user1|user2|user3)@xyz\.com
! $MATCH


or even better(it converts usernames to lowercases, so if you want to
save a copy into files user1 etc., they'll always lowercase), but
probably this is an overkill:

# I think you can also change 3rd line to contain
# ^TO_\/(user1|user2|user3)@xyz\.com
   :0
   *
   ^TO_\/(user1|user2|user3)@
   * MATCH ?? ()\/[^(_at_)]+
   { 
    USR=$MATCH
    users="user1%user1!user2%user2!user3%user3"
    :0:
    * $ users ?? ()$USR%\/[^!]+
    $MATCH
    :0E:
    $USR
   }


Another nice option for converting uppercase to lowercase is:

    # where VAR contains the mixed-case string
    :0D
    * VAR ?? [A-Z]
    { VAR=`echo "$VAR" | tr [A-Z] [a-z]` }

Everything is stolen from this list. ;)
-- 
Martin Mokrejs - PGP5.0i key is at http://www.natur.cuni.cz/~mmokrejs
<mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz> Faculty of Science, The Charles 
University



<Prev in Thread] Current Thread [Next in Thread>
  • filterring, sagar naik
    • Re: filterring, Martin Mokrejs <=