Re: [exim] Can you help me with my filters ?

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Kirill Miazine
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [exim] Can you help me with my filters ?
* lee [2004-12-14 07:01]:
>
> hello everyone,
>
> I've tried and looked things up for some time, but I just can't sort out
> my problem.
> Which is;
> When I send an email to the 2 addresses shown below _in one mail_, the
> result is 2 copies of my mail get sent to _each_ address.
>
> I've experimented a little by using 'else' and shortening the filter
> file, but that didn't result in a better result; indeed results seemed
> stranger as I recall.
>
> So, any help greatly welcomed here. Below is the filter file; you may
> think my filtering reasons look weird, but there is a practical purpose.


You should be aware that the processing of the filtering instructions
does not stop once some action has been performed.

> Thanks,
> Lee
>
> if $header_to: contains "incel@???" and
>    $header_content-type: contains "boundary"
> then
>    pipe "/home/incel/www/mailgust/dbcron.pl 18"
> endif
> if $header_to: contains "incel@???" and
>    $header_content-type: does not contain "boundary"
> then
>    pipe "/home/incel/www/demime.pl '|/home/incel/www/mailgust/dbcron.pl 18'"
> endif
> if $header_to: contains "incelot@???" and
>    $header_content-type: contains "boundary"
> then
>    pipe "/home/incel/www/mailgust/dbcron.pl 5"
> endif
> if $header_to: contains "incelot@???" and
>    $header_content-type: does not contain "boundary"
> then
>    pipe "/home/incel/www/demime.pl '|/home/incel/www/mailgust/dbcron.pl 5'"
> endif


When you send a message

    To: incel@???, incelot@???


Exim will first route the message to incel@??? and then to
incelot@???.

When it routes to incel@??? it will see that To: contains
incel@??? and pipe it to dbcron.pl 18. It doesn't stop here.
It goes on and sees incelot@??? in To:. So it pipes it do
dbcron.pl 5 as well. So, both 18 and 5 recieved a copy here.

The same happens when delivering the message to incelot@???.

You should use "$local_part" instead of $header_to:. $header_to: will
not change, but $local_part will be "incel" or "incelot" depending on
which address the message is being routed to.

You should also use "finish" after you pipe the mail. E.g.

  if $header_to: contains "incel@???" and
     $header_content-type: contains "boundary"
  then
     pipe "/home/incel/www/mailgust/dbcron.pl 18"
     finish
  #  ^^^^^^ <- the above will stop processing of the filter instructions
  endif


Cheers
Kirill

-- 
They make a desert and call it peace.
                -- Tacitus