Re: [Exim] Remove sender from group expansion alias

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Nigel Wade
Data:  
Para: David S. Madole
CC: Exim users list
Asunto: Re: [Exim] Remove sender from group expansion alias
David S. Madole wrote:
>>From: "Nigel Wade" <nmw@???>
>>
>>David S. Madole wrote:
>>
>>>>From: "Nigel Wade" <nmw@???>
>>>>
>>>>I am trying to tidy up a minor annoyance I have in my Exim setup. But so
>>>
>>>far
>>>
>>>
>>>>I've not been able to find any solution to the problem. I currently do
>>>
>>>group
>>>
>>>
>>>>expansion in aliases using an LDAP lookup in a redirect router. The
>
> lookup
>
>>>>is done using the data option, and returns a list of mail address which
>>>
>>>are
>>>
>>>
>>>>then redirected.
>>>>
>>>>Currently, if the sender is a member of the group, they receive a copy
>
> of
>
>>>>the message they sent. I'd like to be able to change this, and remove
>
> the
>
>>>>sender from the expanded list. Is there any way to do this within the
>>>>redirect router?
>>>
>>>
>>>I don't think there's an easy way to remove the sender from the list,
>
> but
>
>>>you could suppress the delivery.
>>>
>>>See the message below I sent a few days ago on the list on the same
>
> topic.
>
>>>Simon did send me a reply that this approach worked for him.
>>>
>>>David
>>>
>>>
>>>-----
>>>
>>>
>>>
>>>>From: "David S. Madole" <david@???>
>>>>
>>>>>From: "Simon Fraser" <simonfr@???>
>>>>>
>>>>>As far as the documentation and posts here indicate, there's no
>>>>>configuration option for turning off 'me too' posts resulting from
>>>>>alias expansions.
>>>>>
>>>>>I've attempted to fake this ability using the data line I've included
>>>>>below, but it seems a nasty way of doing it. It would be a lot
>>>>>simpler if I could guarantee that the expanded addresses were all
>>>>>qualified. As it is, it removes the entire sender_address if the
>>>>>sender's domain is not the one that unqualified usernames get given,
>>>>>and removes the local_part with an optional domain if it is.
>>>>
>>>>What if you put something like this before your other routers:
>>>>
>>>>absorb_me_too:
>>>> condition = ${if eq{$sender_address}{$local_part@$domain}{if
>>>>
>>>
>>>
> eq{$original_local_part@$original_domain}{$local_part@$domain}{false}{true}}
>
>>>>}{false}}
>>>> data = :blackhole:
>>>>
>>>>This is totally untested, you might need to tweak the brackets, and it
>>>
>>>might
>>>
>>>
>>>>not do what you want at all. Just an idea.
>>>>
>>>>Basically, if the sender and recipient are the same address and the
>>>
>>>address
>>>
>>>
>>>>is not the result of an expansion, discard the message.
>>>>
>>>>Also, have you looked at qualify_preserve_domain?
>>>>
>>
>>I'll investigate something along these lines. I think my logic will be
>>different, as I need to dispose of the message if the local_part *is* the
>>result of an expansion (otherwise noone can ever send mail to themselves).
>>I've not encountered $original_local_part before.
>
>
>
> That's exactly what it is intended to do as written. The original_local_part
> and original_domain contain the recipient address as it appeared before any
> alias processing, so comparing it to the current recipient address tells you
> if it was the result of expansion. If they are different, then an alias
> expansion occurred. That's what I wrote.


I didn't actually sort out the logic of the exim config. but in the text you
said "and the address is not the result of an expansion, discard the
message". I took that to mean discard if $local_part is not expanded, which
is the the opposite of what I wanted to do.

Based on your suggestion, this is the router I've come up with:

absorb_me_too:
    driver  = redirect
    condition = ${if and { \
    {eq {$sender_address} {$local_part@$domain}} \
    {! eq{$original_local_part@$original_domain}{$local_part@$domain}} \
    } {true} {false} }
    data = :blackhole:


So far all the tests I've done show it to be doing what is required.

>
> There are a few other things that original_local_part and original_domain
> reflect also that you might need to take into account, read the
> specification for details.


I will.

Thanks again for your help.


--
Nigel Wade, System Administrator, Space Plasma Physics Group,
             University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@???
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555