procmail
[Top] [All Lists]

Re: Problem with .procmailrc

2001-01-02 16:24:30
Sorry about the earlier incomplete msg.

Ravindra Kumar wrote:
...
Configuration done at client: From client I am runnning fetchmail which =
downloads all mails from central(_at_)xyz(_dot_)com and gives to local user =
central. I have put one .procmailrc in central's home directory with =
following lines:
  :0 c
  backup    =20
  :0c
  * ^To.*user1
    {
        :0
        ! user1(_at_)localhost
    }
  :0c
  * ^To.*user2
    {
        :0
        ! user2(_at_)localhost
    }

As Philip said about six weeks ago:
# How many times do I have to say it: YOU CANNOT RELIABLY AND CORRECTLY
# ROUTE EMAIL USING THE ADDRESS(ES) IN THE HEADER.

See:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2000-11/msg00174.html

Of course he's right; messages can arrive for someone even though
his/her name does not appear in the header address.  Please study his
message carefully.

Now, IF you can guarantee that all mail destined for your user/s has
header address/es...  Well, you can't really, but if you're willing to 
live with the restriction that you only handle mail that contains
header-addresses, then...

With above lines, my intention is to forward mail to user1 if To =
contains user1(_at_)xyz(_dot_)com and forward to user2 if To contains 
user2(_at_)xyz(_dot_)com
Problem :=20
1) A mail whose To address is To: 
user2(_at_)xyz(_dot_)com,Yuser1(_at_)yahoo(_dot_)com
is got delivered to both user1 and user2.

My exact requirement:=20
1)Procmail should match entire string "user1(_at_)xyz(_dot_)com not" just 
user1
and user1(_at_)xyz(_dot_)com can be anywhere in the To address.

Not the CC: address?  Or "apparently-to:" or "resent-to:" ??
See the procmailrc manpage and look for "TO_"

2) Once a mail is delieverd to any user it should not be in central's =
mail box
3) A mail which is not delievered to any user only should be present in =
central's mail box.

A "delivered" flag would be safe:

  :0 c
  backup

  # Not delivered to any user
  DELIVERED=no

  :0c
  * ^TO_user1(_at_)xyz(_dot_)com
  ! user1(_at_)localhost
  :0a
  { DELIVERED=yes }     # only if forwarded to user1(_at_)localhost

  :0c
  * ^TO_user2(_at_)xyz(_dot_)com
  ! user2(_at_)localhost
  :0a
  { DELIVERED=yes }     # only if forwarded to user2(_at_)localhost

  :0
  * DELIVERED ?? no
  $DEFAULT

However, the above recipe is still completely UNRELIABLE for the
reasons Philip outlines.  You're better off routing based on
X-Envelope-To: or some MTA-supplied information.
-- 
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Problem with .procmailrc, Collin Park <=