Re: [exim] Bounce router based on both sender and recipient

Top Page
Delete this message
Reply to this message
Author: Jarle Hammen Knudsen
Date:  
To: Exim Users
Subject: Re: [exim] Bounce router based on both sender and recipient
Hi, Mike!

In my original mail I mistakenly referred to the same file twice . 
Correction:

What I am trying to do is define a router which bounces the message if
both these conditions are true:

    1. sender is listed in /etc/exim4/ses-senders
    2. recipient is listed in /etc/exim4/ses-suppress

I do want per recipient filtering on this. Only recipients listed in
ses-suppress should be bounced. Messages with multiple recipients should
be delivered to the other recipients.

The reasoning behind looking at a router to do this was because it was a
router I wanted to restrict.

Anyway, this seems to to the trick:

    send_via_ses_block:
       driver = redirect
       debug_print = "R: send_via_ses_block"
       domains = ! +local_domains
       senders = lsearch;/etc/exim4/ses-senders
       condition = ${lookup {$local_part@$domain} lsearch
    {/etc/exim4/ses-suppress} {1} {0}}
       allow_fail
       data = :fail: Address is known to bounce. We cannot attemt to
    send to this address. (Local suppression list)


Is it a bad idea to use a router for this? The server is very low volume.

All the best,
Jarle


On 09.01.2018 13.36, Mike Brudenell wrote:
> Hi, Jarle -
>
> Am I missing something, but why do you need a *router* to do this?
> Couldn't you do it in an *acl_smtp_rcpt ACL* instead? You can test the
> sender and recipient address easily then rejects the message with a
> *deny* if met. Something like this, perhaps (untested!)…
>
> deny senders    = lsearch;/etc/exim4/ses-suppress
>      recipients = lsearch;/etc/exim4/ses-suppress
>      message    = …some suitable rejection response text…
>
> When the ACL spots a recipient address listed in ses-suppress
> *and* also has a sender address listed there then the recipient is
> rejected. (By the way, did you mean to use "ses-suppress" for both
> senders and recipients there, by the way? Not "ses-senders" for the
> sender?)
>
> However think carefully if this is what you want for the "edge cases"…
>
> For example, suppose a sender listed in ses-suppress tried to send a
> message to *two* recipients, *only one* of which is listed in
> ses-suppress?
>
>   * Do you want just the listed recipient to be rejected and the
>     message still to be delivered to the other (unlisted) recipient?
>   * Or do you want the entire message to be dropped to
>     *all* recipients if *any* recipient is listed in ses-suppress?

>
> As it stands my suggestion above does the former, not the latter.
>
> Cheers,
> Mike B-)
>
> On 8 January 2018 at 19:08, Jarle Hammen Knudsen via Exim-users
> <exim-users@??? <mailto:exim-users@exim.org>> wrote:
>
>     I have the following router:

>
>     send_via_ses:
>       driver = manualroute
>       debug_print = "R: send_via_ses"
>       domains = ! +local_domains
>       transport = ses_smtp
>       route_list = * email-smtp.eu-west-1.amazonaws.com
>     <http://email-smtp.eu-west-1.amazonaws.com>;
>       senders = lsearch;/etc/exim4/ses-senders

>
>     If the sender is listed in /etc/exim4/ses-senders the mail is sent
>     via the smarthost.

>
>     I also have a list of recipient addresses known to bounce in
>     /etc/exim4/ses-suppress.

>
>     What I am trying to do is define a router which bounces the
>     message if both these conidtions are true:

>
>         1. sender is listed in /etc/exim4/ses-suppress
>         2. recipient is listed in /etc/exim4/ses-suppress

>
>     If the sender is not listed in /etc/exim4/ses-suppress these two
>     routers should be skipped.

>
>     I have worked on this for quite some time without success so any
>     help is very much appreciated.

>
>     -- 
>     Jarle Hammen Knudsen

>
>
>     -- 
>     ## List details at
>     https://lists.exim.org/mailman/listinfo/exim-users
>     <https://lists.exim.org/mailman/listinfo/exim-users>
>     ## Exim details at http://www.exim.org/
>     ## Please use the Wiki with this list - http://wiki.exim.org/

>
>
>
>
> --
> Systems Administrator & Change Manager
> IT Services, University of York, Heslington, York YO10 5DD, UK
> Tel: +44-(0)1904-323811
>
> Web:www.york.ac.uk/it-services <http://www.york.ac.uk/it-services>
> Disclaimer:www.york.ac.uk/docs/disclaimer/email.htm
> <http://www.york.ac.uk/docs/disclaimer/email.htm>